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

Home -> Community -> Usenet -> c.d.o.misc -> Re: PRO*C bug?

Re: PRO*C bug?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 1998/11/13
Message-ID: <36618961.108493745@192.86.155.100>#1/1

A copy of this was sent to pdrouin_at_remove_this.nortel.ca (Nortel) (if that email address didn't require changing) On Fri, 13 Nov 1998 13:44:12 -0500, you wrote:

>Hello everyone,
>
> I am running into a weird PRO*C problem. Here's the pseudo code I use:
>
>EXEC SQL DECLARE C_TM_EXTRACT CURSOR FOR
>SELECT blabla...
>
>EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE ERROR!");
>
>EXEC SQL CONNECT :user_id IDENTIFIED BY :user_passwd;
>
>EXEC SQL EXECUTE
>BEGIN
> tm_utils.create_initial_list(1, 18289, 496181);
>END;
>END-EXEC;
>
>EXEC SQL OPEN C_TM_EXTRACT;
>
>(*1) EXEC SQL WHENEVER NOT FOUND DO break;
>for (;;)
>{
> EXEC SQL FETCH C_TM_EXTRACT INTO :blablabla
>}
 

 EXEC SQL WHENEVER NOT FOUND CONTINUE; Add that and you'll be ok. the problem is, the exec sql whenever not found do break is adding code like:  

   if ( sqlca.sqlcode == 1403 ) break;

After all embedded sql. Thats great inside of a loop -- its not so great OUTSIDE of the loop. You need to tell pro*c that you will handle the NOT FOUND condition yourself and don't want auto generated code at that point...

>
>EXEC SQL CLOSE C_TM_EXTRACT;
>
>(*2) EXEC SQL EXECUTE
> BEGIN
> tm_utils.create_initial_list(1, 18289, 496182);
> END;
>END-EXEC;
>
>
> This last EXEC SQL EXECUTE block (*2) will not compile once I get to the
>C compiler. The PRO*C compiler can do its business just fine but I can't
>get it to compile using Sun's C compiler. It will complain and tell me
>that it found "break outside loop or switch".
>
> This is all right if I remove line (*1), it will compile in both PRO*C
>and regular C.
>
> Any help is appreciated.
> Regards,
> P
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA

--
http://govt.us.oracle.com/    -- downloadable utilities
 
----------------------------------------------------------------------------
Opinions are mine and do not necessarily reflect those of Oracle Corporation
 
Anti-Anti Spam Msg: if you want an answer emailed to you, 
you have to make it easy to get email to you.  Any bounced
email will be treated the same way i treat SPAM-- I delete it.
Received on Fri Nov 13 1998 - 00:00:00 CST

Original text of this message

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