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 |
What is enter substitution variable in oracle?
How can I combine multiple rows into a comma-delimited list in oracle?
How to upsert (update or insert into a table)?
How to define a data source name (dsn) in odbc manager?
What are operators in oracle?
what is difference between DBMS and RDBMS?
What is a recycle bin in oracle?
What is the purpose of tables, private synonyms and public synonyms in Oracle?
Can u make a synonym for deptno=10 only from emp table.
WHAT IS ecc 6.0
Other than making use of the statspack utility, what would you check when you are monitoring or running a health check on an Oracle 8i or 9i database?
What is sequence?