Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: SQL*Plus and PL/SQL >> date function!!!!!

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: date function!!!!!
 Rush  Posted: Feb 21, 2007 12:12:14 AM

 Total Post: 127
 Joined: Jan, 2007






 hello every body
i have a problem in fetching rows between given two dates.plzzzzzz help me...
i am writing my qury like this
select * from emp where hiredate between to_date('20-sep-81','dd-mon-yy')and to_date('31-dec-81','dd-mon-yy');
is this right or wrong plz give me righ code.my id is->gullu02@gmail.com
thanking you
RUPESH

 Ghulam
Posted: Feb 21, 2007 12:41:49 AM  

 Total Post: 8
 Joined: Feb, 2007






 
To compare two dates, you must be careful to match same datatype. You can convert all left and right sode variable of comparision operator to either char or date formats.

Below is the tested code plz.

select hire_date from employees where to_date(hire_date, 'dd-mon-yy') between to_date('20-sep-97','dd-mon-yy') and to_date('30-sep-97','dd-mon-yy')
/


 Rush
Posted: Feb 21, 2007 01:00:18 AM  

 Total Post: 127
 Joined: Jan, 2007






 
dear Ghulam i am very very thankful to you.thank you!!!!:-) your code is working and have solved my problem.you are the first person who helped me through dbapool.nice to see your reply.
RUPESH
gullu@gamail.com

 Ghulam
Posted: Feb 21, 2007 01:06:12 AM  

 Total Post: 8
 Joined: Feb, 2007






 
One more tip for you.

Normally functions convert datatype internally (automatically) but thats not the recommended method.
Following code will work properly:

select * from dual where '1' = 1;

But it creates problem when comparing dates!!!!

Cheers

 Rush
Posted: Feb 21, 2007 04:30:39 AM  

 Total Post: 127
 Joined: Jan, 2007






 
thank ghulam to give me tips like this.nice to see you friend!!!!

 Time Zone: EDT

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Vinoth Kumar357
  Gopu Gopi340
  Gitesh Trivedi322
  neeraj sharma258
  Ramesh Jois246






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software