Solved

Error ORA-01858

Posted on 2003-11-20
4
2,206 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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

770 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