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

From: Gary Piper <gpiper_at_ozemail.com.au>
Date: 1996/11/01
Message-ID: <327A92D9.4EAD_at_ozemail.com.au>#1/1


Walter Roberson 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.

Try..

EXEC SQL INSERT into etc....
SELECT sysdate from dual;

Oracle is very good at inserting date and time.

~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~ Gary Piper ( gpiper_at_ozemail.com.au )
http://www.ozemail.com.au/~gpiper/

Phone  : 61-3-9827-4276
Fax    : 61-3-9827-4917
Mobile : 0419-352-584 ( International 61-419-352-584 )
----------------------------------------------------------------------
Received on Fri Nov 01 1996 - 00:00:00 CET

Original text of this message