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

Home -> Community -> Usenet -> c.d.o.tools -> Re: ProC Mystery

Re: ProC Mystery

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 2000/06/20
Message-ID: <8ip08c$3db$1@nnrp1.deja.com>#1/1

In article <8idgmh$qg4$1_at_nnrp1.deja.com>,   Melissa <mp2114_at_my-deja.com> wrote:
> I am not sure how this is happening, but a co-worker was working on
 some
> ProC code and had typed a very simple INSERT instruction. After the
> ProC compiler finished generating the corresponding C file, the CC
> compiler indicated a compile error with the following message:
>
> Error 1571: Break statement has no enclosing loop or switch.
>
> The odd thing about this problem is that the ProC compiler has placed
 a
> line of code at the end stating the following:
>
> if (sqlca.sqlcode == 1403) break;
>
> This line should not even be present in the code. I have looked over
> the code several times and do not see anything wrong with the way the
> INSERT has been coded. To compound the situation further, if the
 INSERT
> command is commented out of the code, the CC compiler compiles with no
> errors.
>
> Has anyone else seen something similar to this? If so, how were you
> able to resolve the issue? My first suggestion was to take out that
> function in the current file and place it into a new *.pc file, then
> recompile.
>
> Any suggestions anyone could supply would be greatly appreciated!
>
> -- Melissa
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

somewhere in the file physically ABOVE the insert you will find

exec sql whenever NOTFOUND do break;

whoever put it there forgot to put:

exec sql whenever NOTFOUND CONTINUE;

after the loop. It is very common to code:

   exec sql open c;
   for(;;)
   {

      exec sql whenever notfound do break;
      exec sql fetch c into :x;
      ....

   }
   EXEC SQL WHENEVER NOTFOUND CONTINUE; <<<<----- IMPORTANT!!!    exec sql close c;

that way, we stop putting out the check for 1403's and break...

--
Thomas Kyte (tkyte_at_us.oracle.com) Oracle Service Industries
Howtos and such: http://osi.oracle.com/~tkyte/index.html
Oracle Magazine: http://www.oracle.com/oramag
Opinions are mine and do not necessarily reflect those of Oracle Corp


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Jun 20 2000 - 00:00:00 CDT

Original text of this message

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