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: WHENEVER SQLWARNING? in Pro*C

Re: WHENEVER SQLWARNING? in Pro*C

From: Michael Krolewski <mikkro_at_hbsi.com>
Date: 1997/11/20
Message-ID: <3473FF70.44B5@hbsi.com>#1/1

Jorge A. San Martín wrote:
>
> Hi,
> I have a problem with the WHENEVER SQLWARNING statement, I wrote the
> following code
>
> EXEC SQL WHENEVER SQLERROR DO sqlerror();
> EXEC SQL WHENEVER SQLWARNING DO sqlerror();
> ....
> EXEC SQL select column from table;
>
> in which I mispell the column name and unfortunately the proc doesn't
> detect the error that the column name is wrong.
> When I compile, the proc doesn´t detect the column doesn't exist in the
> table, and in execution the error is not detected also.
> I looked at the generated .c and it looks like this:
>
> sqlstm.stmt = "select column from table";
> ....
> sqlstm.sqparm = sqlstm.sqharm;
> sqlstm.sqparc = sqlstm.sqharc;
> sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
> if (sqlca.sqlcode < 0) sqlerror(); <--- DOES NOT
> REALIZE OF THE ERROR
> if (sqlca.sqlwarn[0] == 'W') sqlerror(); <--- DOES NOT REALIZE
> OF THE ERROR
>
> Does any Oracle Guru out there have any idea of what the problem is?
> How can I detect this kind of errors?
> SQLCA was declared, so it should be OK.
>
> thanxs a lot, please reply to:
> jsanmart_at_dcc.uchile.cl or jsanmart_at_its.cl
>
> Jorge A. San Martín

You can alway (you should always) check the SQLCA for errors whenever you
execute an Oracle statement. I generally stop (assert) execution unless the error is NO_DATA_FOUND or more than one record. If coded properly, none (???) of the other errors should be generated.

If you executed the above code in the debugger and looked at SQLCA, you would find an error stating that the SQL did not parse properly.

A second problem may be that you do not have the compiler check option on.
I believe there are 3 setting NONE, LIMITED, and FULL. Look in the makefile in the compilation command for the ProC file.

Mike Krolewski Received on Thu Nov 20 1997 - 00:00:00 CST

Original text of this message

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