Solved

passing parameters to sql from .csh

Posted on 2004-08-19
4
547 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
  • 3
4 Comments
 
LVL 9

Accepted Solution

by:
pratikroy earned 30 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

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 …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
Via a live example, show how to take different types of Oracle backups using RMAN.

820 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