Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Error ORA-01858

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

790 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