trigger

CREATE TABLE NOMINA
  (
    CodEmp    NUMBER (3) NOT NULL ,
    NomEmp    VARCHAR2 (15 CHAR) ,
    Cargo    VARCHAR2 (20 CHAR) ,
    Salario  NUMBER (8),
    BONO  NUMBER (8)
) ;

create table CONTROL (Usuario varchar2(15),
                    Fecha date,
    Accion varchar2(15)
    );
           
create or replace trigger t_auxilio
  before insert or update of Salario
  on NOMINA
  for each row when(new.Salario < 1000000)
 begin
  insert into CONTROL values(user,sysdate,'Bonifica');
 end t_auxilio;


insert into nomina values (101,'Haider','Ingeniero',2800000,0);
insert into nomina values (102,'Carlos','Produccion',900000,50000);
insert into nomina values (103,'Camilo','Secretaria',737000,50000);
insert into nomina values (104,'Juan','Abogado',800000,50000);
insert into nomina values (105,'Sandra','Contadora',3800000,0);

select * from nomina;

select * from control;

Share this

Related Posts

Previous
Next Post »

Buscar en Wikipedia

Resultados de la búsqueda