Solved

passing parameters to sql from .csh

Posted on 2004-08-19
4
543 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.

Join & Write a Comment

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…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now