--------------------------------------------------------
-- Triggere pentru ROAAUTO v 1.4.151                  --
-- Created by marius.atanasiu on 2/2/2006, 9:53:06 AM --
--------------------------------------------------------

spool triggere.log

prompt
prompt Creating trigger TRG_DEV_ASIGURATORI_BEFOINS
prompt ============================================
prompt
create or replace trigger TRG_DEV_ASIGURATORI_BEFOINS
  before insert on dev_nom_asiguratori
  for each row
  -- local variables here
begin
  select SEQ_dev_nom_asiguratori.NEXTVAL into :new.id_asigurator from dual;
end TRG_DEV_ASIGURATORI_BEFOINS;
/

prompt
prompt Creating trigger TRG_DEV_FURNIZORI
prompt ==================================
prompt
create or replace trigger TRG_DEV_FURNIZORI
  before insert on dev_nom_furnizorimasini
  for each row
declare
  -- local variables here
begin
  select SEQ_dev_nom_FURNIZORIMASINI.NEXTVAL into :new.id_FURNIZOR from dual;
end TRG_DEV_FURNIZORI;
/

prompt
prompt Creating trigger TRG_DEV_MASINICLIENT_BEFOUPD
prompt =============================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_MASINICLIENT_BEFOUPD
BEFORE UPDATE ON DEV_MASINICLIENTI
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin

if :old.ID_MASINICLIENT <> :new.ID_MASINICLIENT then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_masiniclienti', :OLD.id_masiniclient,'ID_MASINICLIENT','N', :OLD.ID_MASINICLIENT, :NEW.ID_MASINICLIENT, PACK_SESIUNE.get_id_util() ) ;
end if;

if :old.ID_TIPMOTOR <> :new.ID_TIPMOTOR then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_masiniclienti', :OLD.id_masiniclient,'ID_TIPMOTOR','N', :OLD.ID_TIPMOTOR, :NEW.ID_TIPMOTOR, PACK_SESIUNE.get_id_util() ) ;
end if;

if :old.ID_FURNIZOR <> :new.ID_FURNIZOR then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_masiniclienti', :OLD.id_masiniclient,'ID_FURNIZOR','N', :OLD.ID_FURNIZOR, :NEW.ID_FURNIZOR, PACK_SESIUNE.get_id_util() ) ;
end if;

if :old.ID_MASINA <> :new.ID_MASINA then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_masiniclienti', :OLD.id_masiniclient,'ID_MASINA','N', :OLD.ID_MASINA, :NEW.ID_MASINA, PACK_SESIUNE.get_id_util()) ;
end if;

if :old.ID_PARTENER <> :new.ID_PARTENER then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_masiniclienti', :OLD.id_masiniclient,'ID_PARTENER','N', :OLD.ID_PARTENER, :NEW.ID_PARTENER, PACK_SESIUNE.get_id_util() ) ;
end if;

if :old.NRINMAT <> :new.NRINMAT then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_masiniclienti', :OLD.id_masiniclient,'NRINMAT','C', :OLD.NRINMAT, :NEW.NRINMAT, PACK_SESIUNE.get_id_util() ) ;
end if;

if :old.SERIES <> :new.SERIES then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_masiniclienti', :OLD.id_masiniclient,'SERIES','C', :OLD.SERIES, :NEW.SERIES, PACK_SESIUNE.get_id_util() ) ;
end if;

if :old.SERIEM <> :new.SERIEM then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_masiniclienti', :OLD.id_masiniclient,'SERIEM','C', :OLD.SERIEM, :NEW.SERIEM, PACK_SESIUNE.get_id_util() ) ;
end if;

if :old.CULOARE <> :new.CULOARE then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_masiniclienti', :OLD.id_masiniclient,'CULOARE','C', :OLD.CULOARE, :NEW.CULOARE, PACK_SESIUNE.GET_ID_UTIL() ) ;
end if;

if :old.KMINT <> :new.KMINT then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_masiniclienti', :OLD.id_masiniclient,'KMINT','N', :OLD.KMINT, :NEW.KMINT, PACK_SESIUNE.GET_ID_UTIL() ) ;
end if;

if :old.DATAACHI <> :new.DATAACHI then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_masiniclienti', :OLD.id_masiniclient,'DATAACHI','D', :OLD.DATAACHI, :NEW.DATAACHI, PACK_SESIUNE.GET_ID_UTIL() ) ;
end if;

if :old.NRACHI <> :new.NRACHI then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_masiniclienti', :OLD.id_masiniclient,'NRACHI','N', :OLD.NRACHI, :NEW.NRACHI, PACK_SESIUNE.GET_ID_UTIL() ) ;
end if;

if :old.SERIEF <> :new.SERIEF then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_masiniclienti', :OLD.id_masiniclient,'SERIEF','C', :OLD.SERIEF, :NEW.SERIEF, PACK_SESIUNE.GET_ID_UTIL() ) ;
end if;

if :old.SERIECV <> :new.SERIECV then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_masiniclienti', :OLD.id_masiniclient,'SERIECV','C', :OLD.SERIECV, :NEW.SERIECV, PACK_SESIUNE.GET_ID_UTIL() ) ;
end if;

if :old.ANFABRICATIE <> :new.ANFABRICATIE then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_masiniclienti', :OLD.id_masiniclient,'ANFABRICATIE','N', :OLD.ANFABRICATIE, :NEW.ANFABRICATIE, PACK_SESIUNE.GET_ID_UTIL() ) ;
end if;

if :old.STERS <> :new.STERS then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_masiniclienti', :OLD.id_masiniclient,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL() ) ;
end if;

if :old.INACTIV <> :new.INACTIV then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_masiniclienti', :OLD.id_masiniclient,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL() ) ;
end if;

end;
/

prompt
prompt Creating trigger TRG_DEV_MASINICLIENTI_BEFOINS
prompt ==============================================
prompt
create or replace trigger TRG_dev_masiniclienti_BEFOINS
before insert on dev_masiniclienti
referencing old as old new as new
for each row
begin
select SEQ_dev_masiniclienti.NEXTVAL into :new.id_masiniclient from dual;
end;
/

prompt
prompt Creating trigger TRG_DEV_MECANICI_BEFOINS
prompt =========================================
prompt
create or replace trigger TRG_dev_mecanici_BEFOINS
before insert on dev_mecanici
referencing old as old new as new
for each row
begin
select SEQ_dev_mecanici.NEXTVAL into :new.id_mecanic from dual;
end;
/

prompt
prompt Creating trigger TRG_DEV_MECANICI_BEFOUPD
prompt =========================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_MECANICI_BEFOUPD
BEFORE UPDATE ON DEV_MECANICI
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin

if :old.ID_MECANIC <> :new.ID_MECANIC then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_mecanici', :OLD.id_mecanic,'ID_MECANIC','N', :OLD.ID_MECANIC, :NEW.ID_MECANIC, PACK_SESIUNE.GET_ID_UTIL() ) ;
end if;

if :old.ID_SALARIAT <> :new.ID_SALARIAT then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_mecanici', :OLD.id_mecanic,'ID_SALARIAT','N', :OLD.ID_SALARIAT, :NEW.ID_SALARIAT, PACK_SESIUNE.GET_ID_UTIL() ) ;
end if;

if :old.ID_SECTIE <> :new.ID_SECTIE then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_mecanici', :OLD.id_mecanic,'ID_SECTIE','N', :OLD.ID_SECTIE, :NEW.ID_SECTIE, PACK_SESIUNE.GET_ID_UTIL() ) ;
end if;

if :old.STERS <> :new.STERS then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_mecanici', :OLD.id_mecanic,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL() ) ;
end if;

if :old.INACTIV <> :new.INACTIV then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_mecanici', :OLD.id_mecanic,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL() ) ;
end if;

end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_ANSAMBLE_BEFOINS
prompt =============================================
prompt
create or replace trigger TRG_dev_nom_ansamble_BEFOINS
before insert on dev_nom_ansamble
referencing old as old new as new
for each row
begin
select SEQ_dev_nom_ansamble.NEXTVAL into :new.id_ansamblu from dual;
end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_ANSAMBLE_BEFOUPD
prompt =============================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_NOM_ANSAMBLE_BEFOUPD
BEFORE UPDATE ON DEV_NOM_ANSAMBLE
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin

if :old.STERS <> :new.STERS then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_ansamble', :OLD.id_ansamblu,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.INACTIV <> :new.INACTIV then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_ansamble', :OLD.id_ansamblu,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_ANSAMBLU <> :new.ID_ANSAMBLU then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_ansamble', :OLD.id_ansamblu,'ID_ANSAMBLU','N', :OLD.ID_ANSAMBLU, :NEW.ID_ANSAMBLU, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.DENUMIRE <> :new.DENUMIRE then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_ansamble', :OLD.id_ansamblu,'DENUMIRE','C', :OLD.DENUMIRE, :NEW.DENUMIRE, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_ASIGURAT_BEFOUPD
prompt =============================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_NOM_ASIGURAT_BEFOUPD
BEFORE UPDATE ON DEV_NOM_ASIGURATORI
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin

if :old.STERS <> :new.STERS then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_asiguratori', :OLD.id_asigurator,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.INACTIV <> :new.INACTIV then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_asiguratori', :OLD.id_asigurator,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_ASIGURATOR <> :new.ID_ASIGURATOR then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_asiguratori', :OLD.id_asigurator,'ID_ASIGURATOR','N', :OLD.ID_ASIGURATOR, :NEW.ID_ASIGURATOR, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ASIGURATOR <> :new.ASIGURATOR then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_asiguratori', :OLD.id_asigurator,'ASIGURATOR','C', :OLD.ASIGURATOR, :NEW.ASIGURATOR, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_DELEGATI_BEFOINS
prompt =============================================
prompt
create or replace trigger TRG_dev_nom_delegati_BEFOINS
before insert on dev_nom_delegati
referencing old as old new as new
for each row
begin
select SEQ_dev_nom_delegati.NEXTVAL into :new.id_nom_delegati from dual;
end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_DELEGATI_BEFOUPD
prompt =============================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_NOM_DELEGATI_BEFOUPD
BEFORE UPDATE ON DEV_NOM_DELEGATI
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin

if :old.STERS <> :new.STERS then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_delegati', :OLD.id_nom_delegati,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.INACTIV <> :new.INACTIV then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_delegati', :OLD.id_nom_delegati,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_NOM_DELEGATI <> :new.ID_NOM_DELEGATI then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_delegati', :OLD.id_nom_delegati,'ID_NOM_DELEGATI','N', :OLD.ID_NOM_DELEGATI, :NEW.ID_NOM_DELEGATI, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.DELEGAT <> :new.DELEGAT then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_delegati', :OLD.id_nom_delegati,'DELEGAT','C', :OLD.DELEGAT, :NEW.DELEGAT, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ELIBERATDE <> :new.ELIBERATDE then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_delegati', :OLD.id_nom_delegati,'ELIBERATDE','C', :OLD.ELIBERATDE, :NEW.ELIBERATDE, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_PARTENER <> :new.ID_PARTENER then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_delegati', :OLD.id_nom_delegati,'ID_PARTENER','N', :OLD.ID_PARTENER, :NEW.ID_PARTENER, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.BI <> :new.BI then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_delegati', :OLD.id_nom_delegati,'BI','C', :OLD.BI, :NEW.BI, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_FURNIZOR_BEFOUPD
prompt =============================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_NOM_FURNIZOR_BEFOUPD
BEFORE UPDATE ON DEV_NOM_FURNIZORIMASINI
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin

if :old.ID_FURNIZOR <> :new.ID_FURNIZOR then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_furnizorimasini', :OLD.id_furnizor,'ID_FURNIZOR','N', :OLD.ID_FURNIZOR, :NEW.ID_FURNIZOR, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.DENUMIRE <> :new.DENUMIRE then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_furnizorimasini', :OLD.id_furnizor,'DENUMIRE','C', :OLD.DENUMIRE, :NEW.DENUMIRE, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.STERS <> :new.STERS then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_furnizorimasini', :OLD.id_furnizor,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.INACTIV <> :new.INACTIV then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_furnizorimasini', :OLD.id_furnizor,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_INSPECTO_BEFOUPD
prompt =============================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_NOM_INSPECTO_BEFOUPD
BEFORE UPDATE ON DEV_NOM_INSPECTORI
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin

if :old.STERS <> :new.STERS then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_inspectori', :OLD.id_inspector,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.INACTIV <> :new.INACTIV then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_inspectori', :OLD.id_inspector,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_INSPECTOR <> :new.ID_INSPECTOR then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_inspectori', :OLD.id_inspector,'ID_INSPECTOR','N', :OLD.ID_INSPECTOR, :NEW.ID_INSPECTOR, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.INSPECTOR <> :new.INSPECTOR then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_inspectori', :OLD.id_inspector,'INSPECTOR','C', :OLD.INSPECTOR, :NEW.INSPECTOR, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_ASIGURATOR <> :new.ID_ASIGURATOR then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_inspectori', :OLD.id_inspector,'ID_ASIGURATOR','N', :OLD.ID_ASIGURATOR, :NEW.ID_ASIGURATOR, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_INSPECTORI_BEFOINS
prompt ===============================================
prompt
create or replace trigger TRG_dev_nom_inspectori_BEFOINS
before insert on dev_nom_inspectori
referencing old as old new as new
for each row
begin
select SEQ_dev_nom_inspectori.NEXTVAL into :new.id_inspector from dual;
end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_MARCI_BEFOINS
prompt ==========================================
prompt
create or replace trigger TRG_dev_nom_marci_BEFOINS
before insert on dev_nom_marci
referencing old as old new as new
for each row
begin
select SEQ_dev_nom_marci.NEXTVAL into :new.id_marca from dual;
end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_MARCI_BEFOUPD
prompt ==========================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_NOM_MARCI_BEFOUPD
BEFORE UPDATE ON DEV_NOM_MARCI
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin

if :old.STERS <> :new.STERS then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_marci', :OLD.id_marca,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.INACTIV <> :new.INACTIV then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_marci', :OLD.id_marca,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_MARCA <> :new.ID_MARCA then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_marci', :OLD.id_marca,'ID_MARCA','N', :OLD.ID_MARCA, :NEW.ID_MARCA, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.MARCA <> :new.MARCA then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_marci', :OLD.id_marca,'MARCA','C', :OLD.MARCA, :NEW.MARCA, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_MASINI_BEFOINS
prompt ===========================================
prompt
create or replace trigger TRG_dev_nom_masini_BEFOINS
before insert on dev_nom_masini
referencing old as old new as new
for each row
begin
select SEQ_dev_nom_masini.NEXTVAL into :new.id_masina from dual;
end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_MASINI_BEFOUPD
prompt ===========================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_NOM_MASINI_BEFOUPD
BEFORE UPDATE ON DEV_NOM_MASINI
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin

if :old.STERS <> :new.STERS then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_masini', :OLD.id_masina,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.INACTIV <> :new.INACTIV then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_masini', :OLD.id_masina,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_MASINA <> :new.ID_MASINA then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_masini', :OLD.id_masina,'ID_MASINA','N', :OLD.ID_MASINA, :NEW.ID_MASINA, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_MARCA <> :new.ID_MARCA then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_masini', :OLD.id_masina,'ID_MARCA','N', :OLD.ID_MARCA, :NEW.ID_MARCA, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.MASINA <> :new.MASINA then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_masini', :OLD.id_masina,'MASINA','C', :OLD.MASINA, :NEW.MASINA, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.SCTIP <> :new.SCTIP then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_masini', :OLD.id_masina,'SCTIP','C', :OLD.SCTIP, :NEW.SCTIP, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.CLASA <> :new.CLASA then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_masini', :OLD.id_masina,'CLASA','C', :OLD.CLASA, :NEW.CLASA, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_NORME_BEFOINS
prompt ==========================================
prompt
create or replace trigger TRG_dev_nom_norme_BEFOINS
before insert on dev_nom_norme
referencing old as old new as new
for each row
begin
select SEQ_dev_nom_norme.NEXTVAL into :new.id_norme from dual;
end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_NORME_BEFOUPD
prompt ==========================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_NOM_NORME_BEFOUPD
BEFORE UPDATE ON DEV_NOM_NORME
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin

if :old.STERS <> :new.STERS then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_norme', :OLD.id_norme,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.INACTIV <> :new.INACTIV then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_norme', :OLD.id_norme,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_NORME <> :new.ID_NORME then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_norme', :OLD.id_norme,'ID_NORME','N', :OLD.ID_NORME, :NEW.ID_NORME, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_ANSAMBLU <> :new.ID_ANSAMBLU then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_norme', :OLD.id_norme,'ID_ANSAMBLU','N', :OLD.ID_ANSAMBLU, :NEW.ID_ANSAMBLU, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_MASINA <> :new.ID_MASINA then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_norme', :OLD.id_norme,'ID_MASINA','N', :OLD.ID_MASINA, :NEW.ID_MASINA, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;


if :old.DENOP <> :new.DENOP then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_norme', :OLD.id_norme,'DENOP','C', :OLD.DENOP, :NEW.DENOP, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.CODOP <> :new.CODOP then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_norme', :OLD.id_norme,'CODOP','C', :OLD.CODOP, :NEW.CODOP, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.TIMPN <> :new.TIMPN then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_norme', :OLD.id_norme,'TIMPN','N', :OLD.TIMPN, :NEW.TIMPN, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_PRETURI_BEFOINS
prompt ============================================
prompt
create or replace trigger TRG_dev_nom_preturi_BEFOINS
before insert on dev_nom_preturi
referencing old as old new as new
for each row
begin
select SEQ_dev_nom_preturi.NEXTVAL into :new.id_pret from dual;
end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_PRETURI_BEFOUPD
prompt ============================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_NOM_PRETURI_BEFOUPD
BEFORE UPDATE ON DEV_NOM_PRETURI
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin

if :old.STERS <> :new.STERS then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_preturi', :OLD.id_pret,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.INACTIV <> :new.INACTIV then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_preturi', :OLD.id_pret,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_PRET <> :new.ID_PRET then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_preturi', :OLD.id_pret,'ID_PRET','N', :OLD.ID_PRET, :NEW.ID_PRET, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_MARCA <> :new.ID_MARCA then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_preturi', :OLD.id_pret,'ID_MARCA','N', :OLD.ID_MARCA, :NEW.ID_MARCA, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_ASIGURATORI <> :new.ID_ASIGURATORI then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_preturi', :OLD.id_pret,'ID_ASIGURATORI','N', :OLD.ID_ASIGURATORI, :NEW.ID_ASIGURATORI, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.PRET <> :new.PRET then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_preturi', :OLD.id_pret,'PRET','N', :OLD.PRET, :NEW.PRET, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.PRET_VAL <> :new.PRET_VAL then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_preturi', :OLD.id_pret,'PRET_VAL','N', :OLD.PRET_VAL, :NEW.PRET_VAL, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_VALUTA <> :new.ID_VALUTA then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_preturi', :OLD.id_pret,'ID_VALUTA','N', :OLD.ID_VALUTA, :NEW.ID_VALUTA, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.CURS <> :new.CURS then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_nom_preturi', :OLD.id_pret,'CURS','N', :OLD.CURS, :NEW.CURS, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_RESP_BEFOINS
prompt =========================================
prompt
create or replace trigger TRG_DEV_NOM_RESP_BEFOINS
before insert on DEV_NOM_RESP
referencing old as old new as new
for each row
begin
select SEQ_DEV_NOM_RESP.NEXTVAL into :new.ID_RESP from dual;
end;
/

prompt
prompt Creating trigger TRG_DEV_NOM_RESP_BEFOUPD
prompt =========================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_NOM_RESP_BEFOUPD
BEFORE UPDATE ON DEV_NOM_RESP
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin

  if :old.ID_RESP <> :new.ID_RESP then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('DEV_NOM_RESP',
       :OLD.ID_RESP,
       'ID_RESP',
       'N',
       :OLD.ID_RESP,
       :NEW.ID_RESP,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.NUME <> :new.NUME then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('DEV_NOM_RESP',
       :OLD.ID_RESP,
       'NUME',
       'C',
       :OLD.NUME,
       :NEW.NUME,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.BI <> :new.BI then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('DEV_NOM_RESP',
       :OLD.ID_RESP,
       'BI',
       'C',
       :OLD.BI,
       :NEW.BI,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.CNPRESP <> :new.CNPRESP then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('DEV_NOM_RESP',
       :OLD.ID_RESP,
       'CNPRESP',
       'C',
       :OLD.CNPRESP,
       :NEW.CNPRESP,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.ALES <> :new.ALES then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('DEV_NOM_RESP',
       :OLD.ID_RESP,
       'ALES',
       'N',
       :OLD.ALES,
       :NEW.ALES,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.STERS <> :new.STERS then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('DEV_NOM_RESP',
       :OLD.ID_RESP,
       'STERS',
       'N',
       :OLD.STERS,
       :NEW.STERS,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

end;
/

prompt
prompt Creating trigger TRG_DEV_OPER_BEFOINS
prompt =====================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_OPER_BEFOINS
BEFORE INSERT ON DEV_OPER
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin
  select SEQ_dev_oper.NEXTVAL into :new.id_oper from dual;
  pack_sesiune.dev_idOper := :new.id_oper;
end;
/

prompt
prompt Creating trigger TRG_DEV_OPER_BEFOUPD
prompt =====================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_OPER_BEFOUPD
BEFORE UPDATE ON DEV_OPER
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin

if :old.ID_OPER <> :new.ID_OPER then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_oper', :OLD.id_oper,'ID_OPER','N', :OLD.ID_OPER, :NEW.ID_OPER, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_ORDL <> :new.ID_ORDL then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_oper', :OLD.id_oper,'ID_ORDL','N', :OLD.ID_ORDL, :NEW.ID_ORDL, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_NORME <> :new.ID_NORME then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_oper', :OLD.id_oper,'ID_NORME','N', :OLD.ID_NORME, :NEW.ID_NORME, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_FACT <> :new.ID_FACT then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_oper', :OLD.id_oper,'ID_FACT','N', :OLD.ID_FACT, :NEW.ID_FACT, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.TIMPN <> :new.TIMPN then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_oper', :OLD.id_oper,'TIMPN','N', :OLD.TIMPN, :NEW.TIMPN, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.PRET <> :new.PRET then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_oper', :OLD.id_oper,'PRET','N', :OLD.PRET, :NEW.PRET, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.DATAI <> :new.DATAI then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_oper', :OLD.id_oper,'DATAI','D', :OLD.DATAI, :NEW.DATAI, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_SECTIE <> :new.ID_SECTIE then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_oper', :OLD.id_oper,'ID_SECTIE','N', :OLD.ID_SECTIE, :NEW.ID_SECTIE, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_UTIL <> :new.ID_UTIL then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_oper', :OLD.id_oper,'ID_UTIL','N', :OLD.ID_UTIL, :NEW.ID_UTIL, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.DATAORA <> :new.DATAORA then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_oper', :OLD.id_oper,'DATAORA','D', :OLD.DATAORA, :NEW.DATAORA, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.id_UTILS <> :new.id_UTILS then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_oper', :OLD.id_oper,'ID_UTILS','N', :OLD.id_UTILS, :NEW.id_UTILS, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.DATAORAS <> :new.DATAORAS then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_oper', :OLD.id_oper,'DATAORAS','D', :OLD.DATAORAS, :NEW.DATAORAS, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.STERS <> :new.STERS then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_oper', :OLD.id_oper,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.VALIDAT <> :new.VALIDAT then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_oper', :OLD.id_oper,'STERS','N', :OLD.VALIDAT, :NEW.VALIDAT, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.NOU <> :new.NOU then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_oper', :OLD.id_oper,'NOU','N', :OLD.NOU, :NEW.NOU, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

if :old.ID_UTILI <> :new.ID_UTILI then
 INSERT INTO LOG
(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util)
values
('dev_oper', :OLD.id_oper,'ID_UTILI','N', :OLD.ID_UTILI, :NEW.ID_UTILI, PACK_SESIUNE.GET_ID_UTIL()) ;
end if;

end;
/

prompt
prompt Creating trigger TRG_DEV_OPER_MECANIC_BEFOUPD
prompt =============================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_OPER_MECANIC_BEFOUPD
BEFORE UPDATE ON DEV_OPER_MECANICI
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin

  if :old.ID_OPERMECANIC <> :new.ID_OPERMECANIC then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('DEV_OPER_MECANICI',
       :OLD.ID_OPERMECANIC,
       'ID_OPERMECANIC',
       'N',
       :OLD.ID_OPERMECANIC,
       :NEW.ID_OPERMECANIC,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.ID_MECANIC <> :new.ID_MECANIC then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('DEV_OPER_MECANICI',
       :OLD.ID_OPERMECANIC,
       'ID_MECANIC',
       'N',
       :OLD.ID_MECANIC,
       :NEW.ID_MECANIC,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.ID_OPER <> :new.ID_OPER then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('DEV_OPER_MECANICI',
       :OLD.ID_OPERMECANIC,
       'ID_OPER',
       'N',
       :OLD.ID_OPER,
       :NEW.ID_OPER,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.ORE <> :new.ORE then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('DEV_OPER_MECANICI',
       :OLD.ID_OPERMECANIC,
       'ORE',
       'N',
       :OLD.ORE,
       :NEW.ORE,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.STERS <> :new.STERS then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('DEV_OPER_MECANICI',
       :OLD.ID_OPERMECANIC,
       'STERS',
       'N',
       :OLD.STERS,
       :NEW.STERS,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.INACTIV <> :new.INACTIV then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('DEV_OPER_MECANICI',
       :OLD.ID_OPERMECANIC,
       'INACTIV',
       'N',
       :OLD.INACTIV,
       :NEW.INACTIV,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

end;
/

prompt
prompt Creating trigger TRG_DEV_OPER_MECANICI_BEFOINS
prompt ==============================================
prompt
create or replace trigger TRG_DEV_OPER_MECANICI_BEFOINS
before insert on DEV_OPER_MECANICI
referencing old as old new as new
for each row
begin
select SEQ_DEV_OPER_MECANICI.NEXTVAL into :new.ID_OPERMECANIC from dual;
end;
/

prompt
prompt Creating trigger TRG_DEV_ORDL_BEFOINS
prompt =====================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_ORDL_BEFOINS
BEFORE INSERT ON DEV_ORDL
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin
  select SEQ_DEV_ORDL.NEXTVAL into :new.ID_ORDL from dual;
  pack_sesiune.dev_idOrdl := :new.id_ordl;
end;
/

prompt
prompt Creating trigger TRG_DEV_ORDL_BEFOUPD
prompt =====================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_ORDL_BEFOUPD
BEFORE UPDATE ON DEV_ORDL
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin

  if :old.ID_ORDL <> :new.ID_ORDL then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'ID_ORDL',
       'N',
       :OLD.ID_ORDL,
       :NEW.ID_ORDL,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.LUNA <> :new.LUNA then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'LUNA',
       'N',
       :OLD.LUNA,
       :NEW.LUNA,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.AN <> :new.AN then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'AN',
       'N',
       :OLD.AN,
       :NEW.AN,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.ID_INSPECTOR <> :new.ID_INSPECTOR then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'ID_INSPECTOR',
       'N',
       :OLD.ID_INSPECTOR,
       :NEW.ID_INSPECTOR,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.ID_LUCRARE <> :new.ID_LUCRARE then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'ID_LUCRARE',
       'N',
       :OLD.ID_LUCRARE,
       :NEW.ID_LUCRARE,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.TERMEN <> :new.TERMEN then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'TERMEN',
       'D',
       :OLD.TERMEN,
       :NEW.TERMEN,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.DATAI <> :new.DATAI then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'DATAI',
       'D',
       :OLD.DATAI,
       :NEW.DATAI,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.ORAI <> :new.ORAI then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'ORAI',
       'N',
       :OLD.ORAI,
       :NEW.ORAI,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.DATAE <> :new.DATAE then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'DATAE',
       'D',
       :OLD.DATAE,
       :NEW.DATAE,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.ORAE <> :new.ORAE then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'ORAE',
       'N',
       :OLD.ORAE,
       :NEW.ORAE,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.VALIDAT <> :new.VALIDAT then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'VALIDAT',
       'N',
       :OLD.VALIDAT,
       :NEW.VALIDAT,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.TIP_INCAS <> :new.TIP_INCAS then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'TIP_INCAS',
       'C',
       :OLD.TIP_INCAS,
       :NEW.TIP_INCAS,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.ID_UTIL_AD <> :new.ID_UTIL_AD then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'ID_UTIL_AD',
       'N',
       :OLD.ID_UTIL_AD,
       :NEW.ID_UTIL_AD,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.ID_UTIL_VALID <> :new.ID_UTIL_VALID then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'ID_UTIL_VALID',
       'N',
       :OLD.ID_UTIL_VALID,
       :NEW.ID_UTIL_VALID,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.DATAORAAD <> :new.DATAORAAD then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'DATAORAAD',
       'D',
       :OLD.DATAORAAD,
       :NEW.DATAORAAD,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.DATAORAVALID <> :new.DATAORAVALID then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'DATAORAVALID',
       'D',
       :OLD.DATAORAVALID,
       :NEW.DATAORAVALID,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.ID_UTILS <> :new.ID_UTILS then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'ID_UTILS',
       'N',
       :OLD.ID_UTILS,
       :NEW.ID_UTILS,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.DATAORAS <> :new.DATAORAS then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'DATAORAS',
       'D',
       :OLD.DATAORAS,
       :NEW.DATAORAS,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.ID_FACT <> :new.ID_FACT then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'ID_FACT',
       'N',
       :OLD.ID_FACT,
       :NEW.ID_FACT,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.ID_MASINICLIENT <> :new.ID_MASINICLIENT then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'ID_MASINICLIENT',
       'N',
       :OLD.ID_MASINICLIENT,
       :NEW.ID_MASINICLIENT,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.ID_ASIGURATOR <> :new.ID_ASIGURATOR then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'ID_ASIGURATOR',
       'N',
       :OLD.ID_ASIGURATOR,
       :NEW.ID_ASIGURATOR,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.ID_CONTRACT <> :new.ID_CONTRACT then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'ID_CONTRACT',
       'N',
       :OLD.ID_CONTRACT,
       :NEW.ID_CONTRACT,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.AVANS <> :new.AVANS then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'AVANS',
       'N',
       :OLD.AVANS,
       :NEW.AVANS,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.STERS <> :new.STERS then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'STERS',
       'N',
       :OLD.STERS,
       :NEW.STERS,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.VALCTVA <> :new.VALCTVA then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'VALCTVA',
       'N',
       :OLD.VALCTVA,
       :NEW.VALCTVA,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.ID_TIP <> :new.ID_TIP then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'ID_TIP',
       'N',
       :OLD.ID_TIP,
       :NEW.ID_TIP,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.INCHIS_FORTAT <> :new.INCHIS_FORTAT then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'INCHIS_FORTAT',
       'N',
       :OLD.INCHIS_FORTAT,
       :NEW.INCHIS_FORTAT,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.KMINT <> :new.KMINT then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_ordl',
       :OLD.id_ordl,
       'KMINT',
       'N',
       :OLD.KMINT,
       :NEW.KMINT,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;
end;
/

prompt
prompt Creating trigger TRG_DEV_TIP_DEVIZ
prompt ==================================
prompt
create or replace trigger TRG_DEV_TIP_DEVIZ
before insert on DEV_TIP_DEVIZ
referencing old as old new as new
for each row
begin
select SEQ_DEV_TIP_DEVIZ.NEXTVAL into :new.ID_TIP from dual;
end;
/

prompt
prompt Creating trigger TRG_DEV_TIP_DEVIZ_BEFOUPD
prompt ==========================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_TIP_DEVIZ_BEFOUPD
  BEFORE UPDATE ON DEV_TIP_DEVIZ
  REFERENCING OLD AS OLD NEW AS NEW
  FOR EACH ROW
begin

  if :old.ID_TIP <> :new.ID_TIP then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('DEV_TIP_DEVIZ',
       :OLD.ID_TIP,
       'ID_TIP',
       'N',
       :OLD.ID_TIP,
       :NEW.ID_TIP,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.DENUMIRE <> :new.DENUMIRE then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)

    values
      ('DEV_TIP_DEVIZ',
       :OLD.ID_TIP,
       'DENUMIRE',
       'C',
       :OLD.DENUMIRE,
       :NEW.DENUMIRE,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.STERS <> :new.STERS then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values

      ('DEV_TIP_DEVIZ',
       :OLD.ID_TIP,
       'STERS',
       'N',
       :OLD.STERS,
       :NEW.STERS,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

end;
/

prompt
prompt Creating trigger TRG_DEV_TIPURI_MOTOA_BEFOUPD
prompt =============================================
prompt
CREATE OR REPLACE TRIGGER TRG_DEV_TIPURI_MOTOA_BEFOUPD
BEFORE UPDATE ON DEV_TIPURI_MOTOARE
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
begin

  if :old.DENUMIRE <> :new.DENUMIRE then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_tipuri_motoare',
       :OLD.id_tipmotor,
       'DENUMIRE',
       'C',
       :OLD.DENUMIRE,
       :NEW.DENUMIRE,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.STERS <> :new.STERS then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_tipuri_motoare',
       :OLD.id_tipmotor,
       'STERS',
       'N',
       :OLD.STERS,
       :NEW.STERS,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.INACTIV <> :new.INACTIV then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_tipuri_motoare',
       :OLD.id_tipmotor,
       'INACTIV',
       'N',
       :OLD.INACTIV,
       :NEW.INACTIV,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

  if :old.ID_TIPMOTOR <> :new.ID_TIPMOTOR then
    INSERT INTO LOG
      (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util)
    values
      ('dev_tipuri_motoare',
       :OLD.id_tipmotor,
       'ID_TIPMOTOR',
       'N',
       :OLD.ID_TIPMOTOR,
       :NEW.ID_TIPMOTOR,
       PACK_SESIUNE.GET_ID_UTIL());
  end if;

end;
/

prompt
prompt Creating trigger TRG_DEV_TIPURI_MOTOARE_BEFOINS
prompt ===============================================
prompt
create or replace trigger TRG_dev_tipuri_motoare_BEFOINS
before insert on dev_tipuri_motoare
referencing old as old new as new
for each row
begin
select SEQ_dev_tipuri_motoare.NEXTVAL into :new.id_tipmotor from dual;
end;
/


spool off
