Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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

Answers were Sorted based on User's Feedback



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

Answer / dinesh

DECLARE
c date:='01-JAN-15';
d date:='31-DEC-15';
a number(10);
BEGIN
a:=d-c;
FOR i in 1..a
LOOP
IF to_char(c,'DY')='FRI' THEN
DBMS_OUTPUT.PUT_LINE('THIS IS FRIDAY DATE:='|| ' '|| c);
END IF;
c:=c+1;
END loop;
END;

Is This Answer Correct ?    3 Yes 0 No

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

Answer / dinesh

CREATE OR REPLACE PROCEDURE display_day_date(c date,d date,v varchar2) IS
a number(10);
m date:=c;
BEGIN
a:=d-m;
FOR i in 1..a
LOOP
IF to_char(m,'DY')= v THEN
DBMS_OUTPUT.PUT_LINE('THIS IS'||' '|| v ||' ' || 'DATE for the year '||' '||to_char(m,'yyyy')|| ' '|| m);
END IF;
m:=m+1;
END loop;
END;

Is This Answer Correct ?    1 Yes 0 No

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

Answer / 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

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

Answer / kuldeep

select * from
(

SELECT (TRUNC (SYSDATE, 'yyyy') + LEVEL - 1) dt,
TRIM(TO_CHAR ((TRUNC (SYSDATE, 'yyyy') + LEVEL - 1), 'Day')) dy
FROM DUAL
CONNECT BY LEVEL <= 365

)
where dy='Friday'

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

What are the different dcl commands in sql?

0 Answers  


What is cartesian join in sql?

0 Answers  


Can %notfound return null after a fetch?

0 Answers  


What is the default isolation level in sql server? : Transact sql

0 Answers  


Is vs as in pl sql?

0 Answers  






sales persons should always receive commission of 100 at least. employees who r not sales persons should never receive commission.(Triggers)

1 Answers   Fidelity, Oracle,


GLOBAL TEMPORARY TABLE over Views in advantages insolving mutating error?

0 Answers   Virtusa,


What is sql table?

0 Answers  


How toimport .dmp file in lower version of oracle from higher version ?

4 Answers   TCS,


What is gpt format?

0 Answers  


Can we use commit inside a trigger?

0 Answers  


How to display Row Number with Records in Oracle SQL Plus?

0 Answers   MCN Solutions,


Categories