Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Help with a trigger

Help with a trigger

From: Francesc Vargas <fvargas_at_caixaterrassa.es>
Date: 1998/01/08
Message-ID: <34b50398.0@news.navigato.com>#1/1

I have made a trigger like this...



create or replace trigger control_odd_trig before insert or update on control_taules_odd for each row

declare

        nom_de_taula            varchar(30);
        vegades         number;
begin
        SELECT table_name INTO nom_de_taula FROM all_tables
                WHERE owner = 'DBAPROV' and
                table_name = upper(:new.nom_taula);

        if :new.cal_crear_sn = 'S' then
                SELECT count(*) INTO vegades FROM control_taules_odd
                WHERE entidad = :new.entidad and
                      nom_taula = upper(:new.nom_taula) and
                      cal_crear_sn = 'S';

                if vegades >= 1 then
                        raise_application_error
                         (-20002, 'Una taula sols es pot crear en un
model');
                end if;
        end if;

exception
        when no_data_found then
        raise_application_error
             (-20001, 'Taula ('||:new.nom_taula||') Inexistent');
end;
/

When the insert is ok, execution of the trigger works fine



SQL> insert into control_taules_odd values(2074,'FUNCIONES','N','XX');

1 row created.


but when the trigger make a 'raise_application_error' in the SqlPlus appears:



SQL> r
  1* insert into control_taules_odd values(2074,'YYYY','N','XX') insert into control_taules_odd values(2074,'YYYY','N','XX') *
ERROR at line 1:
ORA-20001: Taula (YYYY) Inexistent
ORA-06512: at "DBAPROV.CONTROL_ODD_TRIG", line 20
ORA-04088: error during execution of trigger 'DBAPROV.CONTROL_ODD_TRIG'

----------------------------------------------------------------------------

The first error is ok (ORA-20001), but why appears the errors ORA-06512 and ORA-04088 ??.

I works in ORACLE 7.3.3.4 on AIX machine.

TIA, Received on Thu Jan 08 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US