Re: How to write current time into Oracle with Pro*c?

From: John Strange <jstrange_at_imtn.dsccc.com>
Date: 1996/11/01
Message-ID: <55deka$prm_at_camelot.dsccc.com>#1/1


Or you could use sysdate. Example code snippet

EXEC SQL UPDATE ECM_USERS SET login_name = :login_id

                      , last_update_date = sysdate
                      , last_updated_by = :login_esd_num
                 WHERE emp_num = :login_esd_num
                   and active_inactive_flag = 'A' ;
 

if (sqlca.sqlcode != 0)
{
  lint_rtn = sprintf (args, "login_name = %s", (char *) login_id.arr) ;   ecm_crash (ORACLE_ERR, app_name, sqlstm.stmt, sqlca.sqlerrm.sqlerrmc, args, }

Walter Roberson (roberson_at_zeno.ibd.nrc.ca) wrote:
: In article <32790079.41C6_at_colorbank.com>,
: Min Wang <mwang_at_colorbank.com> wrote:
: :I want to write current date into Oracle with Pro*c.
: :When I test the following codes alone, it was OK. But when I tried
: :insert them into a Pro*c program, it got problem. Does any one know how
: :to do in right way?
: :I use SGI indy with IRIX 5.3.
 

: :#include <stdio.h>
: :#include <time.h>
: :main(){
: : time_t now;
: : time(&now);
: : printf("%s",ctime(&now));
: :}
 

: From the ctime(2) man page:
 

: ctime, gmtime, asctime, and localtime all return pointers to static data
: which are overwritten on each call.
 

: You are possibly hitting problems because of that. Alternately you
: might be hitting stdio buffering problems. You don't indicate what -kind-
: of problem you got in Pro*c, so it is hard for us to know what went wrong.

--
This posting represents the personal opinions of the author. It is not the
official opinion or policy of the author's employer. Warranty expired when you
opened this article and I will not be responsible for its contents or use.
Received on Fri Nov 01 1996 - 00:00:00 CET

Original text of this message