[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 740
  • Last Modified:

pass parameter in sqlplus

The following command says TEST is not identified.  I use \oracle\ora92\BIN\sqlplus.exe  seems okay.  Thanks.

C:\oracle\10.2.0\BIN\sqlplus.exe -s user/password @c:\test.sql 'TEST'
0
ewang1205
Asked:
ewang1205
1 Solution
 
slightwv (䄆 Netminder) Commented:
Try TEST without the single quotes.

Can you post the contents of test.sql so I can see what it is supposed to do with the parameter?
0
 
Naveen KumarProduction Manager / Application Support ManagerCommented:
i believe inside your test.sql, it should have been used like '&1' to refer to the passed parameter. If yes, then you just need to pause TEST and no need of quotes.

if you parameter value has a space as well then try this :

C:\oracle\10.2.0\BIN\sqlplus.exe -s user/password @c:\test.sql "TEST WORD"
0
 
OP_ZaharinCommented:
- for instance you have more than 1 parameter,
assuming test.sql contain:

SELECT * FROM test
WHERE test_id  = &1
AND test_name = &2

- you would execute it as follows, using comma to separate the values:
SQL> @test.sql parameter1, parameter2
OR
C:\oracle\10.2.0\BIN\sqlplus.exe -s user/password @c:\test.sql 1,TEST
0
 
ewang1205Author Commented:
Yes, Should be '&1' instead of &1.  Thanks.
0

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now