Q:

function that will only insert Monday-Friday?

I've created a function that will insert a customer into the database, I just wondered if it was possible to make it so it will only except inserts on Monday to Friday days at how this would be done in Oracle SQL?
Here is the code for the function that is running and works
FUNCTION CREATE_CUSTOMER(        
       Country IN VARCHAR2
      ,First_Name IN VARCHAR2
      ,Last_Name IN VARCHAR2
      ,Birth_Date IN VARCHAR2
      ,Customer_Type IN VARCHAR2
      ,Address IN VARCHAR2
) return VARCHAR2 IS
  new_customer_id VARCHAR2(8);
BEGIN
SELECT custid_seq.NEXTVAL
INTO new_customer_id
FROM DUAL;
INSERT INTO customer (Customer_id, Country, First_Name, Last_name, Birth_date, Customer_Type, Address)
VALUES (new_customer_id, Country, First_Name, Last_name, Birth_date, Customer_Type, Address);
total_customers := total_customers + 1;
RETURN (new_customer_id);
end;

Anyone got any idea how to develop this or if its possible?
thanks

A:

You want the insert statement to run only on Weekdays? If so, you can check the day of the weeks using
to_char(sysdate,'D')

It returns numbers 1-7(Sunday to Saturday). Based on this you can decide whether to insert or not.

