Solved

Error ORA-01858

Posted on 2003-11-20
4
2,208 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 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Title # Comments Views Activity
Oracle encryption 12 60
Oracle collections 15 39
Input a SQl, output tables amd columns used in the SQL 19 61
sum of columns in a row in oracle 3 42
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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…

749 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