Write a trigger that check the mark is not zero or negative, PL/SQL trigger that check the mark is not zero or negative
create table astd(mark number(3));
insert into astd values(&mark);
SQL> select * from astd;
MARK
---------
23
0
800
0
0
set serveroutput on
create or replace trigger tri29 before insert on astd for each row
declare
tmark astd.mark%type;
begin
tmark:=:new.mark;
if tmark>700 or tmark<0 then
raise_application_error(-20003,'Invalid Mark');
end if;
end;
No comments:
Post a Comment