Misterious Error in Pro*C

From: Pedro Oguri <pedro_oguri_at_yahoo.com>
Date: 19 Jul 2004 15:14:51 -0700
Message-ID: <8f67ef74.0407191414.76b680f_at_posting.google.com>



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 Received on Tue Jul 20 2004 - 00:14:51 CEST

Original text of this message