Need to create a function
Hands‐On Assignment 6‐4 with modifications: Identifying the day of the week for the order date
The day of the week that baskets are created is quite often analyzed to determine consumer shopping patterns. Create a function named DAY_ORD_SF that accepts an order date and returns the day of the week for those orders that have actually been placed. Use the function in a SELECT statement to display each basket id and the day of the week the order was created. Do a second SELECT statement using this function to display the total number of orders for each day of the week that has orders. (Hint: Call the TO_CHAR Function to retrieve the day of week from a date.)
This what I have so far would you be able to send some tweaks?
CREATE OR REPLACE FUNCTION day_ord_sf
(p_order_date IN DATE)
RETURN VARCHAR2
IS
lv_day_week VARCHAR2(9);
BEGIN
SELECT TO_CHAR(p_order_date)'fmdD' , "DAY")
INTO lv_day_week
FROM bb_basket
WHERE idBasket ;
RETURN lv_day_week;
END;