dbTalk Databases Forums  

Misterious Error in Pro*C

comp.databases.oracle comp.databases.oracle


Discuss Misterious Error in Pro*C in the comp.databases.oracle forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Pedro Oguri
 
Posts: n/a

Default Misterious Error in Pro*C - 07-19-2004 , 05:14 PM






On this piece of code:
When SELECT returns nothing sqlca.sqlcode = 0 and no_data_found_func
isnīt called.
How do I know if the insertion was OK?

EXEC SQL
INSERT INTO TB_SWITCH (
ID_SWITCH,
ID_SITE,
ID_PROPRIETARIO,
CD_OPC,
CD_SWITCH,
DS_TIPO_SWITCH,
DT_CRIACAO
)
(
SELECT
SQ_TBSWITCH.NEXTVAL,
s.id_site,
e.id_empresa,
:sw.cd_opc,
:sw.cd_switch,
:sw.ds_tipo_switch,
SYSDATE
FROM tb_empresa e, tb_site s WHERE
(s.cd_intelig_site = :sw.cd_intelig_site AND s.dt_exclusao IS NULL)
AND (e.nm_empresa = :sw.nm_empresa AND
e.dt_exclusao IS NULL)
AND ROWNUM = 1
);

if (sqlca.sqlcode != 0)
{
fprintf (fpLog, "Error on Insert\n", numReg);
}
}


sqlca.sqlcode is always 0.
How do I know if the insertion was OK, then?

Tks!

Pedro Oguri

Reply With Quote
  #2  
Old   
Mr McGeek
 
Posts: n/a

Default Re: Misterious Error in Pro*C - 07-23-2004 , 11:52 AM






Hi Pedro,

You should be able to use:

sqlca.sqlerrd[2]

Which will give you the number of rows processed by the last SQL statement

Cheers

Andy

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.