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 ??
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:
|| Perform whatever steps you need to here for log files etc.
|| 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.
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.