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 >> Solve this!!!

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: Solve this!!!
 PK  Posted: Feb 15, 2007 01:11:52 AM

 Total Post: 10
 Joined: Feb, 2007






 I want to display all saturdays and sundays between two given days

Ex: Want to display saturdays and sundays between 01-Jan-2007 and 31-12-2007

 Oracle Virus
Posted: Feb 15, 2007 01:39:21 AM  

 Total Post: 50
 Joined: Jan, 2007






 
Hi PK,
I cant spare time on writing the whole code, but can suggest you the concept. You have to know the first staturday after 1st Jan 07, then give a loop which will add 5 days each time...which will show you all the saturdays. If you want Sundays, give a loop like that after displaying each Saturday give a break, select it to display the next day (+1) and then again continue with the loop.

Regards,
Aneel Kanuri

 PK
Posted: Feb 15, 2007 05:42:03 AM  

 Total Post: 10
 Joined: Feb, 2007






 
Hi Aneel,

Thanks for your reply. I found the solution. Its working fine.

SELECT mydate, to_char(mydate,'day') FROM (SELECT TO_DATE ('01-01-2007', 'mm-dd-yyyy') + ROWNUM - 1 mydate
FROM all_objects
WHERE ROWNUM < = TO_DATE ('12-31-2007', 'mm-dd-yyyy') - TO_DATE ('01-01-2007', 'mm-dd-yyyy') + 1)
WHERE TO_CHAR (mydate, 'DY') IN ('SAT','SUN')

Do u have any OCA materails, Plz send it to my mail ID prawin4u@gmail.com





 Oracle Virus
Posted: Feb 15, 2007 07:02:01 AM  

 Total Post: 50
 Joined: Jan, 2007






 
Hi Prawin,
Just you can tune the query a bit more. Just try it yourself, you can reach it. I will post you the OCA materials today or tommorow.

Regards,
Aneel Kanuri.

 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 Khokhar843
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Gitesh Trivedi322
  Gopu Gopi272
  neeraj sharma252
  Ramesh Jois245
  Bishal Khetan207






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