![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Call sqlplus in the shell script | beaniebear | Shell Programming and Scripting | 3 | 05-13-2008 09:30 AM |
| help me in sending parameters from sqlplus script to unix shell script | Hara | Shell Programming and Scripting | 2 | 01-29-2008 03:31 PM |
| sqlplus and dbms_output.put_line in shell script | stuck1 | Shell Programming and Scripting | 6 | 12-20-2007 11:40 AM |
| running shell script from sqlplus | dkr123 | Shell Programming and Scripting | 9 | 07-20-2006 10:52 PM |
| passing parameters from a shell script to sqlplus | phani | Shell Programming and Scripting | 2 | 03-13-2005 08:41 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Shell Script And SQLPLUS
i'm having real problems retrieving the returncode of my sqlplus-call. I found a lot of informations on the net, but havn't been able to get it running so far, so now i ask for some help
![]() I do start the sqlplus out of my shell script with the parameters stored in the proc_clips.sql, which is perfectly working. But now i have created some real obviously mistakes like "trunate" or "comit" - but I still get the 0 as returncode. Does anybody have an idea what i'm doing wrong??? Thanks for your help, Martin ###### dbUpdate.sh ###### sqlplus -s userrob@db1/passwrob< proc_clips.sql RETVAL=$? echo $RETVAL echo "SQLPUS-CLIPS" ###### proc_clips.sql ###### set echo on whenever sqlerror exit 1 whenever oserror exit 2 exec martin_s4m_fictions; exec MAJ_RANK; trunate table T_DRAUT_TEMP_CLIPSFICTIONS; comit; exit 0 ###### OUTPUT ###### SP2-0734: unknown command beginning "trunate ta..." - rest of line ignored. SP2-0042: unknown command "comit" - rest of line ignored. 0 SQLPUS-CLIPS |
|
|||||
|
What do your sqlplus scripts look like? Are you using the WHENEVER SQLERROR directive so that a code is sent to the O/S?
WHENEVER SQLERROR EXIT SQL.SQLCODE Cheers, Keith |
|
||||
|
Thank for the idea, but I already use
"whenever sqlerror exit 1" and "whenever oserror exit 2" so this can't eb the problem. Looks like sqlplus ignors my commands... I have posted a part of my shell script, the sql-script i execute and the produced output on the bottom of my first script. |
|
|||||
|
Quote:
Every exit status is good, only dont' use 0 ![]() Here at work we have a whole bunch of sql programs made in this way for avoiding this problem. |
|
|||||
|
Quote:
there is a SQL, PL/SQL or OS error, it's handled before the final exit: Code:
$ sqlplus -s '/ as sysdba'<<<$(printf "whenever sqlerror exit 42\nselect 'hello' from x;\nexit 0")||echo "exit status $?"
select 'hello' from x
*
ERROR at line 1:
ORA-00942: table or view does not exist
exit status 42
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|