How to find no of saturdays in a month using single sql ?

Answer Posted / nagaraju

select count(*) from (
select trunc(to_date(sysdate,'DD/MM/rrrr'),'mm') +rownum -1 dates
from dual connect by level <=Add_Months(trunc(to_date(sysdate,'DD/MM/rrrr'),'mm'),1) - trunc(to_date(sysdate,'DD/MM/rrrr'),'mm')
)
where
to_char(dates,'DY')='SAT'

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to write date and time interval literals in oracle?

563


How to pass parameters to procedures in oracle?

566


How to declare a local variable?

590


what is reindexing?

1168


What privilege is needed for a user to query tables in another schema?

502






How to define a variable to match a table column data type?

574


What is Segment Advisor in Oracle?

663


Explain the use of consistent option in exp command.

546


How to delete an existing row from a table in oracle?

639


What is PL/SQL ?

1106


Can we call procedure inside function in oracle?

602


What happens if you set the sga too low in oracle?

546


Explain the use of indexes option in exp command.

590


1) Does oracle have any table which contain all the exceptions and it's code internally?

1277


Point out the difference between user tables and data dictionary?

536