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 -> Re: PL/SQL time format Q

Re: PL/SQL time format Q

From: Frank van Bortel <fvanbortel_at_netscape.net>
Date: Mon, 11 Apr 2005 10:10:19 +0200
Message-ID: <d3db6r$tan$1@news3.zwoll1.ov.home.nl>


melned wrote:
> I'm attempting to insert a julian time stamp into a table using PL/SQL.
> I'm able to alter my session such that SYSDATE output is julian in a
> select statement:
>
> alter session set NLS_DATE_FORMAT = 'J';
>
> Session altered.
>
> select SYSDATE from dual;
>
> SYSDATE
> -------
> 2453471
>
>
> When I attempt to insert this value, I end up with a 'DD-MMM-YY' format
> such as '10-APR-05'. The column into which I'm attempting to insert is
> of type DATE.
>
>
> alter session set NLS_DATE_FORMAT = 'J';
>
> INSERT into <table name>
> VALUES ( SYSDATE )
>
>
> Any pointers on where I've gone wrong would be greatly appreciated.
>

Sigh... once more: dates are *stored* as NUMBERS. only the display format changes with NLS settings changing, or when using to_char with format masks.

Try to insert SYSDATE, and do a select from the same table with your to_char(SYSDATE,'J') - it works, too!

Now, if you were storing this date into a number column, that would be different... and a Really Bad Idea (tm).

-- 
Regards,
Frank van Bortel
Received on Mon Apr 11 2005 - 03:10:19 CDT

Original text of this message

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