Re: Help With WHENEVER clause

From: Allan Hicks <ahicks_at_acsatlanta.com>
Date: 1996/04/23
Message-ID: <317CFAEF.4AF_at_acsatlanta.com>#1/1


Al Holloway wrote:

        (Paraphrased)

> In the book, Oracle Developer’s Guide, on page 229, it states
> DO RETURN is an action you can
> direct your program to take in a WHENEVER clause.
> Well I tried that action and got the following:
>
> EXEC SQL WHENEVER SQLERROR DO RETURN;
>
> (1) PCC-S-02201, Encountered the symbol ";"
 

> from Pro*.C.

Al,

        I've not seen the WHENEVER ..... DO RETURN

        I started out with Sybase and handed the code over to Pro-C when we went to Oracle and didn't find many incompatabilities. The way I handled
errors was:

EXEC SQL WHENEVER SQLERROR CALL errorhandler();

        My errorhandler function checks the error status in the communications area (sqlca.sqlcode) to see if lodgecomplaint should be called.

lodgecomplaint makes all of the X calls make a message box to tell the user
that he is trouble. After each SQL statement, I check sqlca.sqlcode to see if the operation was successful.

        If your errorhandler function containsa return, you can accomplish the intent of your original SQL statement. It's not pretty, but it should work.

        Since the Sybase SQL compiled and ran under Oracle, I didn't bother with the documentation.

        I hope that this helps, or at least gives you some ideas.

-allan hicks Received on Tue Apr 23 1996 - 00:00:00 CEST

Original text of this message