Re: Java date format in select query
Date: Tue, 4 Nov 2008 17:14:45 +0000
2008/11/4 John Dunn <JDunn_at_sefas.com>
> A 3rd party process is passing a date in java.util.date format to my
> SQLPLUS script and I want to use it in a select statement
> Can the TO_DATE clause handle a java date? If so, whats the syntax?
Assuming that the string is produced with ToString() it should come out as
dow mon dd hh:mm:ss zzz yyyy
(of course there's nothing to stop a java date being serialised any way you like)
dow=day of week ('day' format in Oracle)
zzz =timezone (eg PST - 'TZD' format in Oracle)
hh = hour (ie HH24 in Oracle)
So you should be able to parse this easily enough into a timestamp, and then into a datetime. You could simply make your NLS_TIMESTAMP_TZ_FORMAT parameter the same as the java date format... or fiddle with the java format to make it match a standard Oracle timestamp format...
As it is being passed to a script, I presume it is being used as a literal?
Regards NigelReceived on Tue Nov 04 2008 - 11:14:45 CST