Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Pro*C/C++ and the goto operator

Re: Pro*C/C++ and the goto operator

From: Alex Vinokur <alexander.vinokur_at_telrad.co.il>
Date: Wed, 06 Oct 1999 07:55:56 GMT
Message-ID: <ggDK3.4581$%62.77927@c01read02-admin.service.talkway.com>


On Tue, 05 Oct 1999 08:30:22 -0400 Kenneth C Stahl <BlueSax_at_Unforgettable.com> wrote:
[snip]
> Oracle had a very good reason for including the
>
> EXEC SQL WHENEVER SQLERROR GOTO mylabel;
>
> functionality. The basic intention is that if an erorr does not occur,
> execution will continue with the next statement after whatever SQL
> statement is executed. However, if an error occurs the exeucution will
> branch around the this code to an error handler. For example, here is a
> simple function which uses this logic:
>
> static int Ora_Commit(void)
> {
> EXEC SQL WHENEVER SQLERROR GOTO SQLERR;
> EXEC SQL COMMIT WORK;
> return(0);
>
> SQLERR:
> return(1);
> }
>
> I think this is extremely clean to anyone who understand C and it solves
> the problem succiently and portably.
>

[snip]

The example is convincing.
I think, it is worth using this approach. P.S. This construction seems to be like switch-operator in C.

	Thanks,
	Alex

--
Posted via Talkway - http://www.talkway.com Exchange ideas on practically anything (tm). Received on Wed Oct 06 1999 - 02:55:56 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US