Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Date/Time Settings Causing "Invalid Number" with TRUNC?

BScarbroughJun 1 2016 — edited Jun 1 2016

Good Morning,

I have a particular query (below) that executes successfully in certain sessions within SQL Developer, but not others. In the other sessions, an 'Invalid Number' error returns, unless one of the 'TRUNC' conditions is removed (only the TRUNC). Unfortunately, the only thing I can guess is the particular date/time settings associated with the user's SQL Developers session do not support the formats associated below, which I realize is a long shot. The current setting for the date format is 'DD-MON-YY HH:mm:ss AM'. Could the TO_CHAR '24HH' statement be causing the issue? I wanted to get some thoughts from some experts and determine if an NLS_DATE_FORMAT is really required here (especially since it executes elsewhere) or if there is a particular setting (date/time format) that can be utilized?

SELECT

  TO_CHAR(DATE_1, 'YYYY-MM-DD') FIELD_1,

  TO_CHAR(DATE_1, 'HH24:MI:SS') FIELD_2

FROM

  TABLE_1

AND FIELD_1 >= TRUNC(SYSDATE)-1

AND FIELD_1 < TRUNC(SYSDATE)

Thanks in advance for any help!

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 29 2016
Added on Jun 1 2016
3 comments
1,551 views