On Thu, Jan 03, 2002 at 01:10:14PM -0500, Richard Phillips wrote:
> 
> Does the perl DBI handle oracle dates as simple scalars?  I'm running a
> query that returns a trunc(date,'hh').  This does return
> the full date truncated to the hour.  BUT when I call fetchrow_array I get a
> string with just the day-mon-year.  It seems to be chopping
> off my hour.  Any thoughts?

Oracle uses the NLS_DATE_FORMAT parameter as the default format for dates.
For a specific case, you can use TO_DATE, e.g.:

$dbh->prepare("SELECT TO_DATE(when, 'YYYY-MM-DD HH24:MI:SS') FROM mytable");

or you can change the default format for the session, e.g.:

$dbh->do("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'");

Ronald

Reply via email to