sql - function that will only insert Monday-Friday? -
i've created function insert customer database, wondered if possible make except inserts on monday friday days @ how done in oracle sql?
here code function running , 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 new_customer_id varchar2(8); begin select custid_seq.nextval new_customer_id dual; insert 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 idea how develop or if possible?
thanks
you want insert statement run on weekdays? if so, can check day of weeks using
to_char(sysdate,'d')
it returns numbers 1-7(sunday saturday). based on can decide whether insert or not.
Comments
Post a Comment