Home » Infrastructure » Unix » Return values from sqlplus to Shell script
Return values from sqlplus to Shell script [message #98072] Mon, 19 January 2004 20:12 Go to next message
Prabha R
Messages: 21
Registered: October 2001
Junior Member
Hi,

   I am calling a sql script inside a unix shell.  This sql script will run a query and spool the output to a txt file.  I would like to know whether this sql script ran successfully with correct output.  I am facing 2 problems here:

1) If there is any connection error due to invalid username/password, the command hangs prompting for "Username" or "Password". Since this shell script will be automated, the job will be hanging forever as it requires input.  How do i capture such errors and end the process?

2) Since i am spooling the query output to a file, even when the query throws any Oracle error, it will be written to the outputfile. The next step will be loading this output file data into another table.  If there is any wrong data in the outputfile, i do not want to call the load process at all. But since there could be range of Oracle errors that can happen, I do not know how to find this and stop the next step.

Can anybody pls help me out in solving this.  Your immediate help will be greatly appreciated.

Thanks,

prabha.

 

 
Re: Return values from sqlplus to Shell script [message #98088 is a reply to message #98072] Wed, 04 February 2004 12:42 Go to previous messageGo to next message
Muna
Messages: 1
Registered: February 2004
Junior Member
Here is what I do

export CONNECT_STRING="abc/abc@abc"
JOBID=`echo "set heading off
set echo off
SELECT sysdate
FROM DUAL;" | sqlplus -s $CONNECT_STRING`
echo "JOBID is $JOBID"
Re: Return values from sqlplus to Shell script [message #98137 is a reply to message #98088] Fri, 26 March 2004 00:48 Go to previous message
Ravichandran
Messages: 4
Registered: January 2002
Junior Member
Prabha,

I am also facing similar problem. Can you please tell how you overcame this issue.

Any help will within an hour will be appreciated.

Thanks
Ravi
Previous Topic: simple question
Next Topic: listener dying
Goto Forum:
  


Current Time: Fri Nov 22 20:40:26 CST 2024