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: Oracle Pro*C EXEC SQL statement

Re: Oracle Pro*C EXEC SQL statement

From: Kevin Brand <kevin.brandx_at_tel.gte.com>
Date: Wed, 10 Oct 2001 17:20:56 -0500
Message-ID: <9q2hfv$77u$1@news.gte.com>

A couple things I see.

  1. If your update does not match any rows, you'll get sqlca.sqlcode= +1403, which means your exception handler there will not catch it. Use sqlca.sqlerrd[2] to check whether any rows were updated.
  2. If you do not issue a commit before control is returned to the OS, it is possible that your successful update is getting rolled back on exit.
  3. ~doesn't have anything to do with your issue BUT you should use bind variables here.

-Kevin

"BDargie" <wcdargie_at_statestreet.com> wrote in message news:f5673601.0110101302.1f451cd2_at_posting.google.com...
> Can someone please tell me what is wrong with the code listed below:
>
> EXEC SQL UPDATE vpd_avail
> set AVAIL_IND = 'Y', AVAIL_TIME = '20010926', TIME_STAMP = '20010926'
> where LOAD_DATE = '20010926'
> and DATA_CATEGORY = 'TXN'
> and TABLE_NM = 'txn_trans'
> and REGION_NM = 'na1';
>
> if ( sqlca.sqlcode < 0 ){
> printf("\n\nNO ROWS UPDATED FOR CATEGORY=%s TABLE=%s REGION=%s
> COMBINATION\n\n",
> data_category, table_nm, region_nm);
> return ( -1 );
> }
> return (0);
>
> The sql runs perfectly from sqlplus but when I run the Pro*C exe I
> shows that the record has been updated but in fact it has not.
>
> Thanks.
Received on Wed Oct 10 2001 - 17:20:56 CDT

Original text of this message

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