jdbc - Oracle to_timestamp produces error -
i trying value of time-stamp column using jdbc driver. following query works charm :
to_char(update_date,'yyyy-mm-dd hh24:mi:ss.ff9 tzr') update_date
however, instead of to_char, need timestamp values , if use following query in select statemnt, gives
ota-01821-date format not recognized
error. please can help?
to_timestamp(update_date,'yyyy-mm-dd hh24:mi:ss.ff9 tzr') update_date
the immediate cause of error tzr part of format mask, isn't valid plain timestamp. either convert timestamp with time zone with different function:
to_timestamp_tz(update_date,'yyyy-mm-dd hh24:mi:ss.ff9 tzr')
or omit time zone:
to_timestamp(update_date,'yyyy-mm-dd hh24:mi:ss.ff9')
but uodate_date
timestamp (with [local] time zone), implicitly converting string using your session's nls_timestamp_tz_format
setting, before explicitly converting string timestamp (with or without time zone).
at best pointless, if nls setting doesn't match explicit format use give different error or incorrect results.
if want timestamp value java don't conversion - select original update_date
column, , use jdbc gettimestamp()
retrieve it.
Comments
Post a Comment