Skip site navigation (1) Skip section navigation (2)

Embedded SQL timestamp Question (ECPG)

From: Lee Kindness <lkindness(at)csl(dot)co(dot)uk>
To: Greg Markham <gmarkham(at)markhamdirect(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Embedded SQL timestamp Question (ECPG)
Date: 2004-06-30 11:30:36
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
Just use a double, e.g. something along the lines of:

 double l_tstamp;

 l_tstamp =  (double)seconds;
 l_tstamp += (double)microsecs / 1000000.0;

 EXEC SQL INSERT INTO table(column) VALUES(:l_tstamp);

Watch out for timezones...

Greg Markham writes:
 > I'm trying to use embedded SQL to load some tables and I'm having some 
 > trouble being able to create timestamps using PGTYPEStimestamp_current 
 > routine to create a timestamp before using it in a insert statement.  
 > The issue is that the timestamp that gets created is only to the 
 > second.  I need it to the microsecond.  I will use this timestamp as 
 > part of the primary key of two tables.  Does anyone know how to create a 
 > timestamp object (using PGTYPEStimestamp_current or not) that when 
 > insert via embedded SQL will create a timestamp out to at least 6 
 > milliseconds (i.e. 2004-06-29 12:59:59.999999)?
 > Thank you in advance for any help,
 > - Greg Markham
 > gmarkham(at)markhamdirect(dot)com

In response to

pgsql-interfaces by date

Next:From: Paul TillesDate: 2004-06-30 13:04:13
Subject: how to execute a function directly
Previous:From: Carlos Ojea CastroDate: 2004-06-30 07:13:33
Subject: Re: : query using kylix (delphi)

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group