- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
Program Code:-
create table people(name varchar(13),age number);
DESC people;
create or replace trigger tg
before insert or update
of age
on people
REFERENCING OLD AS o NEW AS n
for each row
when(n.age < 25)
declare
age_out_of_range exception;
begin
raise age_out_of_range;
EXCEPTION
WHEN age_out_of_range THEN
Raise_application_error(-20324,'AGE MUST BE ATLEAST 25 YEARS!');
end;
Output when inserting age below 25:-
insert into people values('one',24);
Comments
Post a Comment