How to find no of saturdays in a month using single sql ?
Answers were Sorted based on User's Feedback
Answer / anuradha
Select Count(*)
From (Select Trunc(To_Date('20120305', 'yyyymmdd'), 'MM')
+ Rownum - 1 Dates
From (Select 1 From Dual Group By Cube(2, 2, 2,
2, 2))
Where Rownum <=
Add_Months(Trunc(To_Date
('20120305', 'YYYYMMDD'), 'MM'), 1) -
Trunc(To_Date('20120305', 'YYYYMMDD'), 'MM'))
Where To_Char(Dates, 'DY') In ('SAT');
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / 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 |
Can we use bind variables in oracle stored procedure?
How to find the date and time of last updated table?
Explain the use of indexes option in exp command.
What is a database schema in oracle?
Can a field be used in a report without it appearing in any data group ?
Display the order number and the number of months since the order was shipped for all orders that have been shipped in the last year (365 days). (Hint: Unshipped orders will have a null value).
difference between oracle8i and oracle9i
What is max rowid in oracle?
How to view all columns in an existing table?
what is the output of select * from emp where null=null & select * from emp where 1=1
Explain a segment?
I want a table like, no name address addr1 addr2 So i want columns like addr1,addr2 under address column. Can one please answer me. Advance Thanks.