-
passing paramets to oracle from unix
Hi,
I am trying to call a sqlscript which takes empids as parameters from shell script.
output of the sql command i am storing in a textfile.
i am calling my sql script thru unix as follows.
1)
i have datafile called data.txt which contains the empid's as follows
123
234
456
678
999
i am passing this data.txt to my unix script as follows.
myunixscript.sh data.txt
in myscript.sh i am framing the values as
'123','234','456','678','999' and stroing them in a variable called empids
3) calling sql script as follows
sqlplus userid/password@sid @mysql.sql empids.
===
mysql.sql
=========
set serveroutput on
spool on
spool /tmp/empids
select * from emptable where empid in ('&1');
spool off
=========================================
when i run the above script its always selecting only one record ie, the fist record for empid = 123
could someone help me in knowing what changes should be done to fetch all the records for the passed empids.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|