?
Solved

passing parameters to sql from .csh

Posted on 2004-08-19
4
Medium Priority
?
550 Views
Last Modified: 2012-06-21
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
Comment
Question by:plennon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 9

Accepted Solution

by:
pratikroy earned 120 total points
ID: 11841098
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
 
LVL 9

Expert Comment

by:pratikroy
ID: 11841119
Ask, if unclear ....

0
 

Author Comment

by:plennon
ID: 11841417
worked first time


thanks



0
 
LVL 9

Expert Comment

by:pratikroy
ID: 11841626
Glad, u found your solution !! Cheers !
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question