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
Similar Messages
-
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> -
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. -
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 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 -
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?
-
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. -
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 -
MM-SUS and EBP-SUS in the same client
Hi experts
I have a doubt about implementationMM-SUS and EBP-SUS in the same client, If I send a PO from MM to SUS and after send a PO from EBP to SUS to the same vendor, the vendor will be able to see 2 POs with just one logon?
As I know when I replicate a vendor from MM to SUS a Business partner is created and when I replicate a the same vendor from EBP to SUS a new Business partner is created and are diferent BP so a user and pass diferent .
Thanks
NilsonHi Nilson,
If i understand your scenario, you'll replicate an existing R/3 vendor to EBP. The vendor will be a direct vendor in R/3 while the same would be used as for Indirects in EBP.
Well, when you replicate the R/3 vendor to EBP, the vendor has the R/3 link in the form of Backend Logical systen name in EBP.
So when you replicate the vendor from R/3 or EBP, there will be ideally only one entry for the vendor with references to R/3 and EBP systems.
Hope this clarifies your question.
Cheers,
Akash -
I recently upgraded to the latest version of FF and now when using a webmail client I am routinely logged out when I try to search e-mail. It works in IE, but I don't like or want to use IE.
== This happened ==
Every time Firefox opened
== TodayUnstable means it can vary in stability day by day as it can be crash prone to being stable. Features can be a work in progress for a while. The May 24 Nighty build was crash prone for a lot of testers for example.
-
VPN between ASA5505 Easy VPN Server and 881G Router as Easy VPN Client
Hello,
I have problem in VPN between ASA5505 Easy VPN Server and 881G Router as Easy VPN Client. ASA 5505 have 7.2.3 software and 881G router have 15.1 software.
881G is configured as hardware client in network exstention mode, and it is placed behind NAT. ASA5505 is working as server. Same VPN Group works correctly from VPN software clients.
When I send traffic from 881G client side, in show cryto sessin detail I see encrypted packets. But with same command I dont see decrypted packet on ASA5505 side. On both devices Phase 1 and Phase 2 are UP.
VPN is working when I replace ASA5505 with ASA5510 correctly with have 8.4.6 software. But problem is that i need to do this VPN between ASA5505 and 881G.
Can you help me, how can I debug or troubleshoot this problem ?
I am unable to update software on ASA5505 side.Hello,
Hire is what my config look like:
crypto ipsec transform-set ESP-DES-SHA esp-des esp-sha-hmac
crypto ipsec transform-set ESP-DES-MD5 esp-des esp-md5-hmac
crypto ipsec transform-set ESP-AES-256-MD5 esp-aes-256 esp-md5-hmac
crypto ipsec transform-set ESP-AES-192-MD5 esp-aes-192 esp-md5-hmac
crypto ipsec transform-set ESP-AES-192-SHA esp-aes-192 esp-sha-hmac
crypto ipsec transform-set ESP-AES-128-MD5 esp-aes esp-md5-hmac
crypto ipsec transform-set ESP-3DES-MD5 esp-3des esp-md5-hmac
crypto ipsec transform-set ESP-AES-128-SHA esp-aes esp-sha-hmac
crypto ipsec transform-set ESP-3DES-SHA esp-3des esp-sha-hmac
crypto ipsec transform-set ESP-AES-256-SHA esp-aes-256 esp-sha-hmac
crypto dynamic-map outside_dyn_map 20 set pfs
crypto dynamic-map outside_dyn_map 20 set transform-set ESP-3DES-SHA
crypto dynamic-map outside_dyn_map 40 set pfs
crypto dynamic-map outside_dyn_map 40 set transform-set ESP-3DES-SHA
crypto dynamic-map outside_dyn_map 60 set pfs
crypto dynamic-map outside_dyn_map 60 set transform-set ESP-3DES-SHA
crypto dynamic-map outside_dyn_map 80 set pfs
crypto dynamic-map outside_dyn_map 80 set transform-set ESP-3DES-SHA
crypto dynamic-map outside_dyn_map 100 set pfs
crypto dynamic-map outside_dyn_map 100 set transform-set ESP-3DES-SHA
crypto dynamic-map outside_dyn_map 120 set pfs
crypto dynamic-map outside_dyn_map 120 set transform-set ESP-3DES-SHA
crypto dynamic-map outside_dyn_map 140 set pfs
crypto dynamic-map outside_dyn_map 140 set transform-set ESP-AES-128-SHA
crypto dynamic-map outside_dyn_map 160 set pfs
crypto dynamic-map outside_dyn_map 160 set transform-set ESP-3DES-SHA
crypto dynamic-map outside_dyn_map 180 set pfs
crypto dynamic-map outside_dyn_map 180 set transform-set ESP-3DES-SHA
crypto dynamic-map outside_dyn_map 200 set pfs
crypto dynamic-map outside_dyn_map 200 set transform-set ESP-AES-256-SHA
crypto map outside_map 65535 ipsec-isakmp dynamic outside_dyn_map
crypto map outside_map interface outside
crypto isakmp enable outside
crypto isakmp policy 1
authentication pre-share
encryption 3des
hash sha
group 2
lifetime 86400
crypto isakmp policy 2
authentication pre-share
encryption 3des
hash sha
group 1
lifetime 86400
crypto isakmp policy 3
authentication pre-share
encryption des
hash sha
group 2
lifetime 86400
tunnel-group HW-CLIENT-GROUPR type ipsec-ra
tunnel-group HW-CLIENT-GROUP general-attributes
address-pool HW-CLIENT-GROUP-POOL
default-group-policy HW-CLIENT-GROUP
tunnel-group HW-CLIENT-GROUP ipsec-attributes
pre-shared-key *******
group-policy HW-CLIENT-GROUP internal
group-policy HW-CLIENT-GROUP attributes
password-storage enable
split-tunnel-policy tunnelspecified
split-tunnel-network-list value cisco_splitTunnelAcl
nem enable -
how can I make two copies of the same picture one with my watermark and one without for printing for clients?
Export the photo twice, once with a watermark and once without a watermark.
-
Check and assign a logical system to client
Hi,
How to check and assign a logical system to clients (for example client number 100)?
Thanks & regards
DuypmBD54- Create Logical system
http://help.sap.com/saphelp_sm32/helpdata/en/69/c24ca94ba111d189750000e8322d00/content.htm
This link also
http://www.sap-img.com/bc059.htm
Regards,
Subhash
Edited by: Subhash Chandra on May 14, 2009 10:21 PM
Maybe you are looking for
-
HT1414 I am having a problem with a black screen.. Please HELP
I am having black screen issues. Have tried all the resets and no luck. I hear it but cant see anything. I called support and they said pay more money for it to get resolved. I cant see paying money for something i dont ffeel i caused. I left it char
-
I was able to use .jar files in Java programs that I write on my computer. I could write a program that used an import statement to bring in classes contained in a .jar file. One day, I was trying to incorporate a jar file folder directly into my win
-
Just a grey screen and an Apple logo!
I installed 10.4.11 yesterday on my old mac, and today when I started it up for a brief second it showed a small folder with a question mark in it which then turned to a folder with the smiley face mac logo and then the grey screen with the Apple, bu
-
Hi All, in my report i need to draw a cross line i.e diagnally. How to draw that? Thanks , Saravanakumar
-
Differences in airplay between ios 6 and 7
Watching video from ipad 2 with ios 6.1.3 through apple tv i could expand the video to fill the tv screen. Since upgrade to 7 i cant figure out how. Can anyone advise?