Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a function that will accept a date as input and will return if the date falls on a weekday or on a weekend. Before
Create a function that will accept a date as input and will return if the date falls on a weekday or on a weekend. Before you start writing this function experiment with queries below.
Current date
(select sysdate from dual;
Yesterday
select sysdate - 1 from dual;
Tomorrow
select sysdate + 1 from dual;
The date format element D returns the number of the day of the week (1-7).
select to_char(sysdate,'D') from dual;
MM returns two-digit numeric abbreviation of month (01-12; JAN = 01)
select to_char(sysdate,'MM') from dual;
Example of the output
SET SERVEROUTPUT ON: SELECT uork_or_not('24-JAN-2017') FROM dual; SELECT work_or_not( '25-JAN-2017 FRO dual; SELECT work_or_not ('17-HAR-2017) FROM dual; Script Output x> Query Result x 4 Task completed in 0 seconds FUNCTION WORK OR_NOT compiled ORK_OR_NOT ('24-JAN-2017') 24-JAN-17 is a work day WORK-OR-NOT( 125-JAN-2017' ) 25-JAN-17 is a uork day. ORK_OR_NOT (' 17-MAR-2017')Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started