PL/SQL Trigger to Restrict User to Make Changes After 5pm

PL/SQL Trigger to Restrict User to Make Changes After 5pm:

create or replace trigger time
before update or delete or insert
on stud
for each row
declare
hour number;
vari char(2);
begin
select to_char(sysdate,'HH') into hour from dual;
select to_char(sysdate,'AM') into vari from dual;
if(hour >= 5 and vari = 'PM') then
raise_application_error(-20000,'Cant insert records now');
end if;
end;

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.