Answer to Question #248738 in Databases | SQL | Oracle | MS Access for Tarurendra Kushwah

Question #248738

Write a PL/SQL program to check whether a date falls on weekend i.e. SATURDAY or SUNDAY.


1
Expert's answer
2021-10-08T23:50:34-0400
DECLARE
    date1 DATE := TO_DATE('&new_dt', 'DD-MON-YYYY');
    day VARCHAR2(15);
    BEGIN
    day := RTRIM(TO_CHAR(date1, 'DAY'));
    IF day IN ('SATURDAY', 'SUNDAY') THEN
    dbms_output.new_line;
    DBMS_OUTPUT.PUT_LINE 
    ('The day of the given date is '||day||' and it falls on weekend');
    ELSE
    dbms_output.new_line;
    DBMS_OUTPUT.PUT_LINE ('The day of the given date is '||day||' and it does not fall on the weekend');
    END IF;
    DBMS_OUTPUT.PUT_LINE ('Execution  Successful');
END;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS