How to display all Friday's in a year with date?

Answer Posted / nihar meher

declare
a date;
b date;
c number(15);
begin
select trunc(sysdate,'yyyy') into a from dual;
select add_months(trunc(sysdate,'yyyy'),12)-1 into b from dual;
c:=b-a;
for i in 1..c
loop
if to_char(a,'dy')='fri'
then
dbms_output.put_line(a);
end if;
a:=a+1;
end loop;
end;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the advantages and disadvantages of views in a database? : Sql dba

765


What is sql select statement?

703


Does truncate need commit?

699


Why partition by is used in sql?

730


Why use truncate instead of delete?

720






How many rows can sqlite handle?

782


What is multiple columns?

778


1) Synonyms 2) Co-related Subquery 3) Different Jobs in Plsql 4) Explain Plan 5) Wrap 6) Query Optimization Technique 7) Bulk Collect 8) Types of index 9) IF primary key is created then the index created ? 10) Foreign Key 11) Exception Handling 12) Difference Between Delete and Trunc 13) Procedure Overloading 14) Grant Revoke 15) Procedure Argument types. 16) Functions. 17) Joins

1329


What is varchar data type in sql?

715


Where is sql database stored?

687


What is the cause of mutating table error and how can we solve it?

786


What is t sql in sql server?

739


What is t-sql? : Transact sql

712


Can you select everything, but 1 or 2 fields, without writer's cramp?

691


What are different clauses used in sql?

813