Whenever sqlerror exit failure rollback in IDE's
Hi all,
Sorry to cross-post, but there is a tendancy for people who have a bunch of Expertise in SQL/PL/SQL to not check other forums all that often so I am hoping for more results here.
I've started a thread over here:
deployment scripts with "exit failure rollback"
The basic problem is that when I have a SQLplus script with
whenever sqlerror exit failure rollbackBut when this is executed through an IDE like toad or SQL developer the IDE appears to ignore the exit command and continues executing the script regardless of any errors.
Has anyone encountered this problem previously and have a solution? or must I beat my deployment manager over the head to convince him to always use SQLPlus for database deployments?
WhiteHat wrote:
Hi all,
Sorry to cross-post, but there is a tendancy for people who have a bunch of Expertise in SQL/PL/SQL to not check other forums all that often so I am hoping for more results here.
I've started a thread over here:
deployment scripts with "exit failure rollback"
The basic problem is that when I have a SQLplus script with
whenever sqlerror exit failure rollbackBut when this is executed through an IDE like toad or SQL developer the IDE appears to ignore the exit command and continues executing the script regardless of any errors.
Has anyone encountered this problem previously and have a solution? or must I beat my deployment manager over the head to convince him to always use SQLPlus for database deployments?"WHENEVER" is sqlplus (only) syntax.
Either only code to work with any/every client or only use sqlplus
Similar Messages
-
Whenever sqlerror exit failure - what value is failure ?
I have a sql*plus script file that is run from a batch file on windows. The script file starts with whenever sqlerror exit failure; But what error value is returned for failure on windows ?
SQL*Plus documentation simply says it's "operating-system dependent values", but I can't find any other documentation saying what these values are!
By trial & error it seems to return 1 on windows, so sets the ERRORLEVEL to 1 within the batch file.
But are the values that SQL*Plus will return actually documented anywhere ?I don't remember ever seeing them documented, but they are the standard error codes for whatever OS you're using. At one time, windows help listed the error codes: 0=good, 1=failure, 2=warning; but I can't find that anymore either. and since the values are different by OS, another option is to exit with a specific value
whenever sqlerror exit 4
then you script becomes more portable, and you don't need to worry about changing errorcodes. -
How to use the WHENEVER SQLERROR EXIT statement in a PL/SQL block.
Hi,
I am getting the following error when trying to add the following statement in an PL/SQL block.
WHENEVER SQLERROR EXIT SQL.SQLCODE
[exec] ERROR at line 23:
[exec] ORA-06550: line 23, column 12:
[exec] PLS-00103: Encountered the symbol "SQLERROR" when expecting one of the
[exec] following:
[exec] := . ( @ % ;
How can i use the above statement in the PL/SQL Block? I have only IF statement in that block( between BEGIN and END).
ThanksHi,
Usually there's always more than one solution.
Can you post an example of what you're trying to accomplish?
That would be useful.
(Place the tag before and after your example to maintain formatting en spacing, see the [fac|http://forums.oracle.com/forums/help.jspa] regarding available tags) -
WHENEVER SQLERROR EXIT SQL.SQLCODE||SQLERRM & Relate ORA-ERRNO & SQLCODE
Hi,
Is there any way to pass both the SQL.SQLCODE & SQLERRM to the os back ??
When I tried WHENEVER SQLERROR EXIT SQL.SQLCODE
The actual oracle error code (ORA-00942) and the error code (174 ) returned by SQL.SQLCODE are different . So how can I get the info. that is related to SQL.SQLCODE
eg :
For this test program
rm -f /home/etladm/test/test.log
sqlplus -S <<EOF >> /home/etladm/test/test.log
ranjeeshk/ics
set verify on time on timing on term on echo on feedback on serveroutput on
WHENEVER SQLERROR EXIT SQL.SQLCODE
-- WHENEVER SQLERROR EXIT SQLERRM
select sysdate sdate from dua;
exit 1
EOF
echo "Number of rows are: $?" >> /home/etladm/test/test.log
echo " -------- Log file -------- \n"
cat /home/etladm/test/test.log
The output was
etladm@stdwdev2:/home/etladm/test>. ./test.ksh
-------- Log file --------
select sysdate sdate from dua
ERROR at line 1:
ORA-00942: table or view does not exist
Number of rows are: 174
etladm@stdwdev2:/home/etladm/test>
So how can I link ORA-00942 and SQLCODE 174 ?
with thanks in advance
Ranjeesh K RFrom the Oracle documentation:
<quote>
The range of operating system return codes is also restricted on some operating systems. This limits the portability of EXIT n and EXIT variable between platforms. For example, on UNIX there is only one byte of storage for return codes; therefore, the range for return codes is limited to zero to 255.
</quote> -
Below is my sql saved as testing.sql
SET PAGESIZE 0
WHENEVER SQLERROR EXIT SQL.SQLCODE;
WHENEVER OSERROR EXIT SQL.OSCODE;
SPOOL /u021/idaho/load_scripts/ebiz_ctgry_prodfam/build_ebiz_ctgry_prodfam_1.og
select
productid,
categoryid,
sequence,
inherit
from site.categoryproduct@TO_EBIZ_DBLINK1
SPOOL OFF
exit
The issue is that code is working as expected on AIX but not on SUN Solaris, here the DBLINK used is invalid one and the select should fail.
AIX Server output:*
sqlplus -s userid/password @testing.sql
from site.categoryproduct@TO_EBIZ_DBLINK1
ERROR at line 13:
ORA-02019: connection description for remote database not found
113620 spss7a04:/u021/idaho/load_scripts/ebiz_ctgry_prodfam> echo $?
*227*
Solarix Server output:*
from site.categoryproduct@TO_EBIZ_DBLINK1
ERROR at line 13:
ORA-02019: connection description for remote database not found
4143 v08k44:/u021/idaho/load_scripts/ebiz_ctgry_prodfam> echo $?
*0*
The question is why in solaris $? returning 0. I have also tried WHENEVER SQLERROR EXIT FAILURE ; option but even that is not working. Also any help in fixing this would be appreciated.It doesn't have to be 'EOF', it can be any token (I know that doesn't help you here).
I don't know if there's any other option for you here, I've always found it good practice to use a terminating token regardless of the particular shell. It seems you are going to have to make a change to get this to port properly in any case, so you may have no choice, however laborious that might be.
Edit you may be better asking this question in a shell scripting forum, for example: [http://www.unix.com/shell-programming-scripting/], and in which case you can close this one off. -
WHENEVER SQLERROR and 11.2.0.2.0 client
Hi,
Facing one issue which am not to understand further.
One of the file say 'config.tmp' has a variable defined as follows:
define termout = 'on';
define SQLErrorHandling = 'continue none';In another sql file say 'myfile.sql' I read the above file as @config.tmp and then try to fetch the variable value as follows:
@config.tmp
execute DBMS_OUTPUT.PUT_LINE('&SQLErrorHandling');
whenever sqlerror &SQLErrorHandling;
set termout &termout;But am getting following error
SQL> @myfile;
continue none
Usage: WHENEVER SQLERROR
{ CONTINUE [ COMMIT | ROLLBACK | NONE ]
| EXIT [ SUCCESS | FAILURE | WARNING | n | <variable> | :<bindvariable> ]
[ COMMIT | ROLLBACK ] }
SQL>Looks like it fails to replace the variable '&SQLErrorHandling' value. However value of '&termout' variable gets fetched.
This issue is not seen when 11.1.0.6.0 client is used. Only when the client version is 11.2.0.2.0 am facing this issue.
Any suggestions?
Regards,
Neuron
p.s.: earlier asked this question under PL/SQL section but no helpful responses.Thanks guys for your replies, please find my comments so far.
I don't understand why you have a call to execute DBMS_OUTPUT ... this is not the place for it. Write to a log file or echo to the terminal window.Thanks 'damorgan', however DBMS_OUTPUT was added from debugging perspective, to check if the value is being fetched or not. Btw that's not the intent of my post and business logic too, what am trying to figure out is why if throws 'Usage: WHENEVER SQLERROR' error only when am connected with 11.2.0.2.0 client. If you help to provide some pointers here, that will be really great.
if you GOOGLE "SQLErrorHandling" you get a number of hits for TSQL & none for Oracle.Thanks 'SB' but sorry I did not understand your comments. Not sure why you want to GOOGLE 'SQLErrorHandling' but you can check this [url http://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12052.htm]link.
Any suggestions for usage errors?
Regards,
Neuron
Edited by: Neuron on Jan 24, 2013 12:30 PM
Edited by: Neuron on Jan 24, 2013 12:34 PM -
WHENEVER SQLERROR does not work for remote db?
Hi,
I've encountered a problem that an error on a remote db (called via db link) does not force SQL*PLUS to exit and report the error.
Local machine: Sun Solaris
Local db: 8.1.7.2
Remote machine: Windows NT, 2000 or XP (I don't know).
Remote db: 9.2.0.5
Call to SQL*PLUS: sqlplus /NOLOG @$BASE_DIR/tools/bin/xxx.sql
Relevant piece of code in xxx.sql:
connect cemis/cemis@loc9280
whenever sqlerror exit SQL.SQLCODE
set heading off
set trimspool on
SET PAGES 0
SET LINESI 250
SET ECHO OFF
SET VERIFY OFF
set termout off
set feedb off
set recsep off
rem *** Do the work ***
whenever sqlerror exit SQL.SQLCODE
rem Get rid of old data
TRUNCATE TABLE local_table;
rem fill table via db-link
INSERT INTO local_table
col1,
col2
SELECT
rem_col1,
rem_col2
FROM rem_user.rem_table@dbl_name
COMMIT;
spool file.csv
SELECT 'Spalte1' || chr(9) || 'Spalte2'
FROM dual;
SELECT col1, col2 FROM local_table;
spool off
exit 0
In our environment the script runs through without any error. After execution the file.csv is not there. No errors in the log file.
I tried to select data from the remote db manually and ran into this:
'ORA-01017: invalid username/password; logon denied' followed by
'ORA-02063: preceding line from dbl_name'.
Do you have any idea why this error does not cause sql*plus to exit?
Does the WHENEVER... only work properly with local errors?
I would be grateful for any information regarding this.
Regards,
GuidoI believe this is a limitation in SP3, but tell me, are you running with a simple producer or a complex producer?
-
I want a script to exit when it executes successfully and to stop when there is a error, so instead of WHENEVER SQLERROR EXIT, I want something like WHENEVER SQLERROR CONTINUE, ELSE EXIT.
How can it be done?"whenever sqlerror continue" does exist and works.
If you want to exit after the whole script is done, just add "exit"
as the last line.
Exiting after one successfull statement when others are following is not possible. -
Problems with WHENEVER SQLERROR
I'm creating a PRO C application, and I'm having problems with the use of WHENEVER SQLERROR DO <function>.
I've got this function: void mensajeDeError(int error); defined in a static library, and compiles perfectly, but when I try to call it from a program, I get this warning message:
warning: improper pointer/integer combination: arg #1
I've checked the call to the function a lot of times, but I haven't got any solution, because it's right.
I've realized, that this funcion (if you put in into a structure of WHENEVER SQLERROR DO), only works if you pass a char* as a parameter too, but not with the rest of stardard types of variables (f.e. ints, floats, etc.,)
I hope you give me a solution.
Thank you.
Juan Carlos.EXEC SQL WHENEVER SQLERROR DO sql_error();
void sql_error()
char msg[512];
size_t buf_len, msg_len;
EXEC SQL WHENEVER SQLERROR CONTINUE;
buf_len = sizeof(msg);
sqlglm(msg, &buf_len, &msg_len);
printf("\nOracle error detected:");
printf("\n%.*s \n", msg_len, msg);
EXEC SQL ROLLBACK WORK RELEASE;
exit(1);
}Hope this help.
Thomas Devalli.
KSI Int'l
[mailto][email protected][mailto]
www.ksi.be
null -
Where should I put WHENEVER SQLERROR CONTINUE clause?
Hi all,
this is my situation:
I have 2 compiled packages and one compiled procedure which uses the 2 packages. I want to start the procedure with sql*plus.
To do this, I wrote a script and start the script from sql*plus:
SQL> @start_proc.sqlThe start_proc.sql script looks like this:
SET SERVEROUTPUT ON
SET ECHO OFF
SET TERMOUT OFF
WHENEVER SQLERROR CONTINUE
SPOOL /home/scott/proc_out.txt
BEGIN
SCHEMA1.TEST_PR;
COMMIT;
END;
SPOOL OFFThe question is, where should i put the statement WHENEVER SQLERROR CONTINUE ?
In the current position, the procedure does not start at all. If I remove the statement completely, then I get error on the first record and the procedure does not go on with the rest of the records...Thanks for your follow-up, Frank.
The bigger picture (imo, hence the "-ism") is still:
When it comes down to error-handling, the world suddenly gets very complicated and turns into all shades of grey, for many years.
(But actually it should be simple: quit when unexpected things happen)
The Developer has done his/her best, based on inputs
The DBA has done his/her best, based on inputs
The Architect/Designer has done his/her best, based on inputs
The Manager has done his/her best, based on inputs
The Client/CST has done his/her best, based on being client/CST
Funny thing is: whenever I mail/call CST asking for additional input, usually things make sense...
I dare say: when things go wrong, let them go wrong.
Propagate the message to another human, who probably didn't think of that/expected it to happen. -
Script error not printed with WHENEVER OSERROR EXIT
Hi!
I run a script with SQL*Plus and noticed, that the script does not stop on an error like this:
SP2-0310: unable to open file "../../some_script.sql"
I added a line of:
WHENEVER OSERROR EXIT
And then it exits on error, but now the error message is not printed.
So it looks like the script was finished successfully.
Is there a way to get both?
The error message and a stop to the script execution?
Version:
SQL*Plus: Release 10.2.0.3.0 - Production on Tue Jul 19 19:05:26 2011
on Windows XP
Regards,
David BalažicCheck out the documentation for the EXIT function.
-
With previous versions of Firefox, I was always asked this question whenever I exit the web browser and turning my laptop off: Do you want to save your bookmarks?... At least that was the message of the question. Right now, my only option is actually closing all the bookmarks and manually opening each one of them or starting from a saved bookmark list.
Thanks!One change in Firefox 4 is to by default stop Firefox displaying the warning message, but it can be turned back on by changing some preferences.
# Type '''about:config''' into the location bar and press enter
# Accept the warning message that appears, you will be taken to a list of preferences
# Locate the preference '''browser.tabs.warnOnClose''', if its value is set to '''false''', double-click on it to change its value to '''true'''
# Repeat this for these 3 preferences '''browser.warnOnQuit''', '''browser.warnOnRestart''' and '''browser.showQuitWarning''' -
I am trying to download a movie in iTunes and I was asked two security questions. They are different form the questions I chose and whenever I exit and try again, I see that the questions change every time. How can I reset the questions?
From a Kappy post
The Best Alternatives for Security Questions and Rescue Mail
1. Send Apple an email request at: Apple - Support - iTunes Store - Contact Us.
2. Call Apple Support in your country: Customer Service: Contact Apple support.
3. Rescue email address and how to reset Apple ID security questions.
An alternative to using the security questions is to use 2-step verification:
Two-step verification FAQ Get answers to frequently asked questions about two-step verification for Apple ID. -
ORA-08176: consistent read failure; rollback data not available
Hi,
We implemented UNDO management on our servers and started getting these errors for few of our programs.:
ORA-08176: consistent read failure; rollback data not available
These errors were not coming when we were using the old rollback segments and we have not changed any code on our server.
1. What is possibly causing these errors?
2. Why did they not surface with rollback segments but started appearing when we implemented AUM and Temporary TS (instead of fixed TS used as temporary TS).
Our environment:
RDBMS Version: 9.2.0.5
Operating System and Version: Windows 2000 AS SP5
Thanks
SatishNOt much in the alert.log. I looked at the trace file, it also does not have much information:
ORA-12012: error on auto execute of job 7988306
ORA-20006: ORA-20001: Following error occured in Lot <4407B450Z2 Operation 7131> Good Bad rollup.ORA-08176: consistent read failure; rollback data not available
ORA-06512: at "ARIES.A_SP$WRAPPER_ROLLUPS", line 106
ORA-06512: at line 1
*** SESSION ID:(75.13148) 2004-11-23 09:16:14.281
*** 2004-11-23 09:16:14.281
ORA-12012: error on auto execute of job 7988556
ORA-20006: ORA-20006: Following error occured in Lot <3351A497V1 Operation 7295> For No FL Rollup, Updating T_GOOD.ORA-08176: consistent read failure; rollback data not available
ORA-06512: at "ARIES.A_SP$WRAPPER_ROLLUPS", line 106
ORA-06512: at line 1
*** SESSION ID:(75.16033) 2004-11-23 09:28:10.703
*** 2004-11-23 09:28:10.703
The version we have is :
Oracle9i Enterprise Edition Release 9.2.0.5.0 - Production
PL/SQL Release 9.2.0.5.0 - Production
CORE 9.2.0.6.0 Production
TNS for 32-bit Windows: Version 9.2.0.5.0 - Production
NLSRTL Version 9.2.0.5.0 - Production
Thanks
Satish -
[PT880] SATA boot failure without old IDE (non boot!) drive
Aaaaargh.
I go to all the trouble of installing my new sata HD, getting it to work, getting it to boot, copying all my stuff from the old drive -
And now, as soon as I yank the old IDE drive, the new drive refuses to boot. I get a "boot failure" message. To boot, I have to have the old drive plugged in. I'm not booting from the IDE. In fact, once the boot process begins I can actually unplug the old drive and everything works fine. But the system staunchly refuses to boot unless it can hold hands with its old drive.
I went into bios and checked the boot sequence - only the new drive is in the sequence. Everything else I can think of checks OK. I've got the latest bios.
Any ideas out there??
Mike GrayQuote from: Maesus on 15-April-06, 16:15:14
bootfailure? did you fdisk your new drive and set an active partition to it? Otherwise the new drive can't boot without an active partition.
Ugh. No, I hadn't fdisked. In over 20 years using (and tinkering with) computers I've never actually upgraded a hard disk before, and I hadn't even realized it. So I had things a bit messed up: the old partition was still labeled as "active" and "system," the new as "boot." At just for a little variety, I thought I would remedy the problem by simply setting the new to "active" in disk management and rebooting.
Can anyone guess what happened? Vewy scawy.
Anyway, after a hair-raising two hours messing around in the recovery console, I have got everything straightened out. And learned some new things about the terms "active," "system" and "boot" in the process.
Maybe you are looking for
-
How do I install Tiger on an external HD?
Can I install Tiger on an external HD connected via FW from the laptop to which it's connected? It seems like the installation disk wants to restart the laptop and only install it there. How do I do a fresh install of OSX on this external HD?
-
Where is the DB_CONFIG file located under Unix environment?
Hello, i'm new to Berkeley db, i have installed the version "db-4.8.30.NC.tar.gz" but now i would like to find the configuration information by using the configuration file. I've read in the documentations that this file is named DB_CONFIG and it exi
-
I have PS CC 14.2.2 on Windows 7 Edit/Fill/Pattern/Script is supposed to offer 'Picture frames' and 'Trees' amongst other options like 'Brick Fill' and so on, but doesn't Why is it so?
-
Error: You have reached the limit of active temporary sites for this account.
When publishing a new site from Muse I got the following message: Error: Could not create Adobe Business Catalyst temporary site. You have reached the limit of active temporary sites for this account. I have only 17 active sites, 5 of them are launch
-
My macbook pro does not print through my PC to my EPSON RX 500 after loading OS X 10.7.4. It shows on the print queue "error" However, it will print if I directly connect my laptop to this printer via the USB connection. Any ideas?