CREATE or replace TRIGGER PersonCheckAge
AFTER INSERT OR UPDATE OF age ON Person
FOR EACH ROW
BEGIN
IF (:new.age < 0) THEN
RAISE_APPLICATION_ERROR(-20000, 'no negative age allowed');
END IF;
END;
insert into Person values (53);
create table persona (
idPersona numeric primary key,
edad numeric,
constraint checkEdad check (edad >=0));
create sequence personaSeq
insert into persona values (personaSeq.nextval,10)
insert into persona values (11,10)
select * from persona
insert into persona values (10)
delete from persona
No hay comentarios.:
Publicar un comentario