3 Replies Latest reply: Jun 23, 2003 1:43 PM by 180592 RSS

    no data found  +1403 or -1403 ?

    276157
      On HP-UX B.11.00 U 9000/800 with Pro*C/C++: Release 8.1.7.4.0

      I use multi-thread programming and on the worker thread there is a update statement:


      EXEC SQL WHENEVER NOT FOUND CONTINUE;

      EXEC SQL update ptcsms_tran_request_r
      set status = 1, to_smsc_date = sysdate, ret_msg_id = :h_rtnmsgid
      where request_id = :item_out.request_id and
      seqno = :item_out.seqno;

      this statement works fine (can update ALL records) but somethimes return sqlca.sqlcode -1403 (no data found), and the SQL is not processed.
      I wonder it should return +1403 if no record satisfy the where clause, and I found it is not related to data problem because if I ignore the error and let the statement perform the update again it can do it successfully.

      would u mind tell me what is the differences between +1403 and -1403 and what is the reasons for returning -1403?
        • 1. Re: no data found  +1403 or -1403 ?
          180592
          The error code associated with "no data found" is +1403. You should not encounter a -1403 error.

          If you look at the generated code, you will see that
          EXEC SQL WHENEVER NOT FOUND . .
          is translated into
          if (sqlca.sqlcode == 1403) . . .

          whereas
          EXEC SQL WHENEVER SQLERROR . . .
          is translated into
          if (sqlca.sqlcode < 0) . . .
          • 2. Re: no data found  +1403 or -1403 ?
            276157
            thats why I got confused. -1403 should not happen w/ UPDATE statement. But it does!

            I use the following to log the error:

            sprintf(logcontent, "ERR CODE: %d, ERR MSG: %.*s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrml
            , sqlca.sqlerrm.sqlerrmc);

            and the output is:

            ERR CODE: -1403, ERR MSG: ORA-01403: no data found

            thanks for your response anyway.
            • 3. Re: no data found  +1403 or -1403 ?
              180592
              Is your sqlca declared in a thread-safe fashion? Sometimes "random" errors can occur in multi-threaded
              precompiler applications if a global sqlca is used.