• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 552
  • Last Modified:

passing parameters to sql from .csh

i have a .csh which executes a sql.
The sql uses a number in the query

i want to execute the sql with the number entered in the csh.

i execute the sql

                             sqlplus -s dbname/dbpword@sname @/orasys/orahome/sqlname.sql

The user usually inputs the number to be queried but i want it to use the parameter from the csh

can this be done?

0
plennon
Asked:
plennon
  • 3
1 Solution
 
pratikroyCommented:
Its simple :

bsfdd171:/oq/home/utdbs01>cat seldt1.sql
select sysdate from dual where dummy = '&1';
exit
bsfdd171:/oq/home/utdbs01>sqlplus -s / @seldt1.sql Y
old   1: select sysdate from dual where dummy = '&1'
new   1: select sysdate from dual where dummy = 'Y'

no rows selected

bsfdd171:/oq/home/utdbs01>sqlplus -s / @seldt1.sql N
old   1: select sysdate from dual where dummy = '&1'
new   1: select sysdate from dual where dummy = 'N'

no rows selected

bsfdd171:/oq/home/utdbs01>sqlplus -s / @seldt1.sql X
old   1: select sysdate from dual where dummy = '&1'
new   1: select sysdate from dual where dummy = 'X'

SYSDATE
---------
19-AUG-04
0
 
pratikroyCommented:
Ask, if unclear ....

0
 
plennonAuthor Commented:
worked first time


thanks



0
 
pratikroyCommented:
Glad, u found your solution !! Cheers !
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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