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

Home -> Community -> Usenet -> c.d.o.server -> Please Check This Code, I'm BrainDead

Please Check This Code, I'm BrainDead

From: <matthew_at_mattshouse.com>
Date: Wed, 25 Nov 1998 15:00:56 GMT
Message-ID: <73h62p$slv$1@nnrp1.dejanews.com>


Pro C Developers,

For some reason, the embedded SQL queries in this subroutine do not execute. I know it's something stupid that my eyes are passing over. I have put comments in the code to help you figure this out. The embedded SQL in the other subroutines are executing nicely, so I know that it's not a connection issue.

void extract_records()
{
 char buf[255],buf2[255];
 int thisdaycode;
 FILE *stream;
 time_t now;
 const char *distime;
 long sec;
 struct tm *tm;

 now = time(NULL);
 tm=localtime(&now);
 thisdaycode=tm->tm_wday;

 if(thisdaycode==0)
   thisdaycode=7;

 sprintf(buf,"%02d:%02d:%02d
%02d-%02d-%d",tm->tm_hour,\
tm->tm_min,tm->tm_sec,tm->tm_mon+1,tm->\

         tm_mday,tm->tm_year +1900);

/* This Syslog entry is made successfully */  syslog(LOG_INFO,buf);

/* An error is never received, so extract_error() is never called */
 EXEC SQL WHENEVER SQLERROR DO extract_error();

/* This Syslog entry is made successfully */
 syslog(LOG_INFO,buf);

/* It obviously gets to this line, but it doesn't

    execute the Update even if I replace the variables     with hard-coded data that works fine in sqlplus. It     also doesn't flag an error */
 EXEC SQL UPDATE masterclocktable set batchtime =

       to_date('15:27:04 11-24-1998','HH24:MI:SS MM-DD-YYYY')
       where openrecord = 0 and indaycode <> :thisdaycode;
 EXEC SQL COMMIT WORK;
/* This Syslog entry is made successfully */
 syslog(LOG_INFO,buf);

/* It gets here also, but the Insert is never done */
 EXEC SQL INSERT INTO extractedrecords

       (select * from masterclocktable
       where (((batchtime) is not NULL)));
 EXEC SQL COMMIT WORK;
/* This Syslog entry is made successfully */
 syslog(LOG_INFO,buf);
}

Am I overlooking some simple error here?

Thanks,
Matthew

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Wed Nov 25 1998 - 09:00:56 CST

Original text of this message

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