Skip to Main Content

SQL & PL/SQL

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!

Getting ORA-01843 Not a Valid Month Error

Periyasamy ChenniyappanOct 6 2015 — edited Oct 6 2015

I am having booking table. In that table departure date, departure time column and both are varchar2 columns. The values are like this in those columns,

Departure Date = 21/05/15

Departure Time = 22:55

I am trying to select records from that table which are having departure between sysdate + 30Hrs and sysdate + 31Hrs.

Following is my query:

select *

from xx_booking

where to_date(depdate || ' ' || deptime,'DD/MM/YY HH24:MI:SS') between sysdate + 30/24 and sysdate + 31/24

Even I tried to select using relational operators (< and >). For less than '<' it's giving result but for greater than '>' it's giving "not a valid month" error

Giving Result:

select *

from xx_booking

where to_date(depdate || ' ' || deptime,'DD/MM/YY HH24:MI:SS') < sysdate + 37/24

Giving Error:

select *

from xx_booking

where to_date(depdate || ' ' || deptime,'DD/MM/YY HH24:MI:SS') >sysdate + 37/24

So I am bit confused why this query working like this. Please show some light to solve this issue.

This post has been answered by Periyasamy Chenniyappan on Oct 6 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 3 2015
Added on Oct 6 2015
4 comments
885 views