Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> EXEC SQL not performing or returning SQLERROR

EXEC SQL not performing or returning SQLERROR

From: Tony <cold_comfort64_at_yahoo.com>
Date: 1 Aug 2001 10:55:43 -0700
Message-ID: <7e4a01c2.0108010955.797036e9@posting.google.com>

Hello all and Thanks in advance for any responses you may send,

I am new to pro 'c'. I have some 'c' exeperince.

I have some code that is not returning what I am expecting. Please review and comment as to my gap in getting it to do what I am expecting. As you can see it is a insert with a select. I have also attach the log file with the output. You will also notice that the log message is recorded before the EXEC and after the test for SQL_ERROR. Additional facts include the sql_error function is not called from the WHENEVER SQLERROR.

Thanks again,

Tony

int init()
{

char* function = "init";  

    EXEC SQL WHENEVER SQLERROR DO sql_error();     LOG_MESSAGE("Made it to the init function before EXEC");     EXEC SQL INSERT INTO ql_pgstore_temp_t1 (store_number)

    	     SELECT store_number
    	     FROM   pg_store_t
    	     	WHERE closed_flag = 'N';	
     

   if (SQL_ERROR_FOUND)
   {

      LOG_MESSAGE("Made it to the error condition01");
      strcpy(table, "TO: ql_pgstore_temp_t FROM: pg_store_t");
      sprintf(err_msg, "ERROR "); 
      WRITE_ERROR(SQLCODE, function, table, err_data);
      return(-1);

   }
   LOG_MESSAGE("Made it PAST the error condition02");

    return(OK);
}/*end init*/

sql_error()
{

   LOG_MESSAGE("ERROR --- *****");
   printf("%d: %s\n", sqlca.sqlcode, err_msg);    exit (NOT_OK);
}

log file:

Wed Aug 1 13:51:21 Program: new_ql_pgstore_load: Made it to the init function before EXEC
Wed Aug 1 13:51:22 Program: new_ql_pgstore_load: Made it PAST the error condition02 Received on Wed Aug 01 2001 - 12:55:43 CDT

Original text of this message

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