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(-82);
select*
from persona
desc persona
delete from persona
create table persona(
idpersona numeric primary key,
edad numeric
constraint checkedad check (edad >=0));
insert into persona values (incremento_id_cliente.nextval,10)
CREATE SEQUENCE incremento_id_cliente
INCREMENT BY 1
START WITH 100
insert into persona(edad) values (20);
insert into persona values (incrementar.nextval,10);
CREATE SEQUENCE incrementar
INCREMENT BY 1
START WITH 1
CREATE or replace TRIGGER Aumentoo
Before INSERT ON Persona
for each row
BEGIN
insert into persona (idpersona) values (incrementar.nextval);
END;
Petunia mascalo con mayo
No hay comentarios.:
Publicar un comentario