Solved

Error ORA-01858

Posted on 2003-11-20
4
2,204 Views
Last Modified: 2010-07-27
ORA-01858 Error is showin when i use this query
select * from salary.emp_detail where months_between(to_date(dateofjoin,'dd/mm/yyyy'),to_date('1/4/2003','dd/mm/yyyy'))>1

where as when i use the same wuery if i rearrange in this manner it is runing
select months_between(to_date(dateofjoin,'dd/mm/yyyy'),to_date('1/4/2003','dd/mm/yyyy')) as datedifference from salary.emp_detail
Can anyone tell y.
Or some otehr soln for writing my query.
I want to retrive records whose date of join is before april 1st.
0
Comment
Question by:SusanBinoy
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
Helena Marková earned 30 total points
ID: 9785817
I think that dateofjoin is DATE and table is SALARY:

select * from salary where months_between(dateofjoin,to_date('1/4/2003','dd/mm/yyyy'))>1;
0
 
LVL 13

Expert Comment

by:anand_2000v
ID: 9785818
if "dateofjoin" is a date field use this command
select * from salary.emp_detail where months_between(dateofjoin,to_date('1/4/2003','dd/mm/yyyy'))>1
0
 
LVL 13

Expert Comment

by:anand_2000v
ID: 9785821
too fast Henka.....;)
0
 

Author Comment

by:SusanBinoy
ID: 9785871
Oh thank a lot for both of u i am so happy it is working this query was driving me mad
I think the mistake i was getting because i was trying to do the to_date function for date of join felid where as i wa getrting error there.
I am so happy it is working
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now