PL/SQL Trigger to Allow User to Make Changes Between 8am to 5pm

PL/SQL Trigger to Allow User to Make Changes Between 8am to 5pm:


create or replace trigger time2
before update or delete or insert
on stud
for each row
declare
hour number;
vari char(2);
flag1 number;
flag2 number;
begin
flag1:=0;
flag2:=0;
select to_char(sysdate,'HH') into hour from dual;
select to_char(sysdate,'AM') into vari from dual;
if(hour >= 8 and hour< 12 and vari = 'AM') then
flag1:=1;
end if;
if(hour >= 12 and hour <= 5 and vari = 'PM') then
flag2:=1;
end if;
if(flag1=0 and flag2=0) then
raise_application_error(-20000,'Cant make cahnges in records now');
end if;
end;

Leave a Reply

Your email address will not be published. Required fields are marked *

thirteen − ten =