how to pass values from oracle sql plus to unix shell script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to pass values from oracle sql plus to unix shell script
# 1  
Old 02-21-2006
how to pass values from oracle sql plus to unix shell script

how to pass values from oracle sql plus to unix shell script
# 2  
Old 02-21-2006
Quote:
Originally Posted by trichyselva
how to pass values from oracle sql plus to unix shell script
... by searching the forums first.
# 3  
Old 02-24-2006
#!/bin/ksh
#
# Oracle and UNIX
#
uid="userid"
pwd="password"
dbms="remote.com"
parm=" 'A1234' "

list=`sqlplus -s <<EOF
$uid/$pwd
set heading off
set pagesize 0
set tab off
SELECT zipcode
FROM companies@$dbms
WHERE company_code=$parm
/
exit
EOF`

for item in $list
do
echo "Output=" $item
done
#
# end of script

There is a good example in the Forum using co-process
You can also try this script for small list type output
Please note that the parameter must be enclosed in single quotes
So there is a double quote surrounding A1234 which is in single quotes
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unable to pass value from .Shell script to .SQL file

Hi All, I am new to shell script. I am trying to pass value from .sh file to .sql file . But I am able to run the .sql file from .sh file with values in sql file. But I am unable to pass the values from .sh file. can some one please help to resolve this. here is my .sh file s1.sh ... (4 Replies)
Discussion started by: reddy298599
4 Replies

2. Shell Programming and Scripting

How to pass Oracle sql script as argument to UNIX shell script?

Hi all, $ echo $SHELL /bin/bash Requirement - How to pass oracle sql script as argument to unix shell script? $ ./output.sh users.sql Below are the shell scripts and the oracle sql file in the same folder. Shell Script $ cat output.sh #!/bin/bash .... (7 Replies)
Discussion started by: a1_win
7 Replies

3. UNIX for Advanced & Expert Users

Use of Oracle pl/sql in UNIX shell script

Hi, I have basic knowledge on how to write pl/sql code inside shell script. I am looking for more advance thing. Is there any book for that which can just talk about how to write more advance plsql code inside shell script. Please help Thanks!!!!!! (1 Reply)
Discussion started by: diehard
1 Replies

4. Programming

pass value from Oracle sql to Korn shell

Hi All , I am trying to pass a value from sqlplus to korn shell . There is a table tab1 in Oracle that has a column userdate. I need to pass the userdate to the korn shell . This is what I am doing . VALUE=`sqlplus -silent username/password << END set pagesize 0 feedback off verify off... (14 Replies)
Discussion started by: megha2525
14 Replies

5. Shell Programming and Scripting

How to pass value from unix shell to sql session?

Here is the situation, I have file from which I am reading records line by line. Based upon some condition I need to pass a field from a sql session to get some data from a table. I don't have any idea how to do it.... (1 Reply)
Discussion started by: mady135
1 Replies

6. Shell Programming and Scripting

How to Pass the Output Values from the PL/SQL Procedure to Shell Script?

hi, Could anyone tell me how to pass the output values of the PL/SQL procedure to Shell script and how to store that values in a shell script variable... Thanks in advance... (5 Replies)
Discussion started by: funonnet
5 Replies

7. Shell Programming and Scripting

How to pass arguments to SQL file passed in shell script?

Hi, I am using SYBASE database. in my script i am connecting to DB via using isql. isql -U${S_USER} -S${S_SERV} -D${S_DB} -P${S_PWD} -b0 -w3000 -h0 -s"|" -i${MYDIR}/ABC.sql -oXYZ.txt << FINSQL i am taking a ABC.sql file to use the queries written in it and storing the output in... (3 Replies)
Discussion started by: dazdseg
3 Replies

8. Shell Programming and Scripting

how to pass the values to unix shell from the oracle stored procedure.

Hi i am calling a stored procedure from unix shell like this call test_proc('0002','20100218'); the stored procedure was giving output like this dbms_output.put_line(' processed earlier'); i want to see the output in the unix shell where i called. Thanks barani (6 Replies)
Discussion started by: barani75
6 Replies

9. Shell Programming and Scripting

How to pass pl/sql table values to shell script

Hello, i am using '#!/bin/bash', i want to make a loop in pl/sql, this loop takes values from a table according to some conditions, each time the loop choose 3 different variables. What i am not able to do is that during the loop i want my shell script to read this 3 variables and run a shell... (1 Reply)
Discussion started by: rosalinda
1 Replies

10. Shell Programming and Scripting

need help on shell script(to pass the values)

only the arguments that are written to the file, my script is (sh /u01app/wkf.sh"$start_no","$name","$Condition","$file_name") like that when ever I run my script I need to write into a new file every time, like wise I have upto10 files with different names.bec my $start_no and $name will... (1 Reply)
Discussion started by: sai123
1 Replies
Login or Register to Ask a Question