470,832 Members | 2,079 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,832 developers. It's quick & easy.

Misterious Error in Pro*C

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
Jul 19 '05 #1
1 2754
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
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Pedro Oguri | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.