How to capture value in shell variable from oracle sql?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to capture value in shell variable from oracle sql?
# 1  
Old 09-24-2008
How to capture value in shell variable from oracle sql?

Hi Friends,

Do someone know how to capture value in a shell variable from oracle sql?

Requirement : In a table we want to count the number of records and want to pass this value to a shell variable where it can be manipulated later. In ksh shell we open oracle connection from sqlplus.

For example :

sqlplus user/passwd <<EOF
variable v_1 number;
select count(*) into :v_1 from table;
exit
EOF

In a shell variable we want to capture the value of v_1..then what is exact syntex to do it?

Thanks in advance.
# 2  
Old 09-24-2008
I have posted today about the same problem.You just need to copy paste.

Please check this link https://www.unix.com/shell-programmin...ellscript.html
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script with Oracle PL/SQL

Hi Gurus, I am new to this unix world...I need your help to walk through. I want to learn shell scripting..... The shell script which can be able to use with oracle pl/sql... So please suggest me which shell is good. Which Unix/Linux version is good for this to Install to get practice the... (8 Replies)
Discussion started by: GaneshAnanth
8 Replies

2. 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

3. 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

4. Shell Programming and Scripting

Capture rows for a column in file from delete sql -Oracle

Hi, This may not be the right forum but i am hoping someone knows an answer to this. I have to capture rows for a column that was deleted. How can i do that without having to write a select query? delete from myschema.mytable where currentdatetimestamp > columnDate this should delete 5... (4 Replies)
Discussion started by: jakSun8
4 Replies

5. Shell Programming and Scripting

Running Oracle SQL from shell script

Hi, can anyone help me with this script please. I need the oracle command to go into the unix batch file. #!/bin/sh # A menu driven Shell script which has following options # for acmtoron@> # # # Exit # As per option do the job #---- while : do clear echo " A C M LOG MONITORING... (0 Replies)
Discussion started by: tinaaguilera
0 Replies

6. UNIX for Dummies Questions & Answers

SQL loader script - ORACLE environmental variable

I am new in unix.. I am running a sql loader script where I have to specify the data file path but the file name contains spaces in it so giving error multiple arguments I have tried it with "" and '' but does n't work the command is : $ORACLE_HOME/bin/sqlldr... (1 Reply)
Discussion started by: Sandip Dey
1 Replies

7. Shell Programming and Scripting

Logging into oracle or SQL from shell script

Hi, I have a shell script where I log on to sqlplus like this log() { sqlplus -s scott/tiger <<! select count(*) from EMP; ! } log Here I have hardcoded/used the username : scott and password : tiger directly to log on to SQLPLUS. If i have my log in information in my profile file... (2 Replies)
Discussion started by: manirsendhil
2 Replies

8. UNIX for Dummies Questions & Answers

Running file sql from shell without capture the password

Dear All I have file a.sql, let's say the content is: _________________________________ select * from dual; exit; _________________________________ and I have shell script a.sh, the content is: _________________________________ ORACLE_SID=testing; export ORACLE_SID... (0 Replies)
Discussion started by: Aditya Purwanto
0 Replies

9. Shell Programming and Scripting

Capture Oracle return code in shell script

I am using the following code in my shell script list=`sqlplus -s $user/$pwd@$dbms<<EOF WHENEVER SQLERROR EXIT SQL.SQLCODE set pagesize 0 feedback off verify off heading off echo off select * from control_tbl where src_nm=$3 and extrct_nm=$4; exit SQL.SQLCODE; EOF` ERROR=$?... (1 Reply)
Discussion started by: Vikas Sood
1 Replies

10. UNIX for Dummies Questions & Answers

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 Replies)
Discussion started by: trichyselva
2 Replies
Login or Register to Ask a Question