[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Error ORA-01858

Posted on 2003-11-20
4
Medium Priority
?
2,211 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
[X]
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
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
Helena Marková earned 90 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

649 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