All Forums Database
sunilp 3 posts Joined 10/11
13 Oct 2011
Bteq equivalent of Sqlplus 'whenever sql error exit failure'

Hi -

 

Is there bteq equivalent of Oracle Sqlplus 'whenever sql error exit failure' ? I know I can code ".IF ERRORCODE <> 0 THEN .QUIT ERRORCODE", but I was just wondering if there is a statement that I can put at the begining and not worry about repeating this code after every SQL ststement in my code ??

 

 

Thanks
Sunil

robpaller 159 posts Joined 05/09
13 Oct 2011

I don't believe so. You could create a single error handling section and then use the .IF ERRORCODE > 0 construct to jump to that section:

 

.LABEL ErrorHandler

/*
|| Perform whatever steps you need to here for log files etc.
*/

.EXIT ERRORCODE;

.LABEL BeginBTEQ

/*
|| Statement 1
*/

.IF ERRORCODE > 0 THEN GOTO ErrorHandler

It doesn't avoid having to repeat the error checking but it allows you to consolidate any processing to a central location in your BTEQ. 

CarlosAL 512 posts Joined 04/08
14 Oct 2011

sunilp:

Take a look at 'SET MAXERROR' in the bteq manuals.

HTH.

Cheers.

Carlos.

 

robpaller 159 posts Joined 05/09
14 Oct 2011

Good call Carlos! +1 for SET MAXERROR.

sunilp 3 posts Joined 10/11
17 Oct 2011

Thanks Carlos and Rob. My goal is to just quit from bteq when it encounters the first error and not process any other statements and ".SET MAXERROR 1" is doing it.  

 

 

Thanks

Sunil

 

 

You must sign in to leave a comment.