Solved

passing parameters to sql from .csh

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
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, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

691 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