Help with Trigger-Mutant table

Dúvidas, dicas e truques de PL/SQL. Aqui também vão assuntos relacionados a pacotes, triggers, funções, Java-Stored Procedures, etc
  

Poston Wed, 30 Jul 2008 6:01 pm

Good afternoon guys, I have a trigger with the following header: CREATE OR REPLACE TRIGGER \"test\". \"TESTE_INTEGRACAO \"BEFORE INSERT ON\" table \"FOR EACH ROW DECLARE when a record is inserted, I need to validate some fields. See the two situations: 1-If a required field is not filled in, in the end I have to do an update on this record that was inserted;

2-If everything is correct the trigger is processed and at the end I have to delete this entry that was inserted;

I entered the command table is about mutant (Pragma Autonomous_Transaction). Gives no error, but the problem is that the update and delete statements do not work.

An important detail: when I insert the second record, it updates or deletes the previous record and not what has been inserted.

Can someone help me?

Nadia
Nadia
Location: São Caetano

Poston Wed, 30 Jul 2008 11:07 pm

Hi Nadia you could assign some value to: NEW.Field if it is null, this way you would eliminate a dml in the table, thus creating a mutant table error, as the second situation did not understand the case, could you be more specific?
paulochagas
Location: São Paulo - SP

Paulo Chagas Filho
__________________

Analista Funcional / Desenvolvedor Oracle EBS
MSN - [email protected]
Gtalk - [email protected]
Skype - paulochagas

Poston Thu, 31 Jul 2008 10:30 am

VERY CAREFULLY ...
Autonomous_Transaction Pragma is not command that HANDLES mutant table ...: shock: viewtopic.php?t=96
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Thu, 31 Jul 2008 11:43 am

I'll try to explain better. Following the logic of the trigger--I DECLARE MY VARIABLES DECLARE ...

BEGIN FEEDING THE VARIABLES AS THAT WAS INSERTED IN THE TABLE. I'm Using: NEW AS BELOW: CampoIntegracao: = UPPER (: New. CampoIntegracao);

--HERE CONTAINS THE ENTIRE TRIGGER PROCESSING CODE WHICH IS WORKING--AT THE END OF THE TRIGGER, BEFORE THE COMMAND (END;) I MUST HAVE THE SITUATION BELOW, IT'S NOT WORKING.

IF Error THEN--If a required field is not filled in, should I do a update on this record UPDATE RECORD (In own record that was inserted) END IF;

IF no error THEN--If there were no errors, delete the registry DELETE RECORD (his own record was inserted) END IF;

I don't know oracle allows you to update and delete in proprio inserted record.

How can I fix this?

Nadia
Nadia
Location: São Caetano


  • See also
    Replies
    Views
    Last Post


        Return to PL/SQL

        Who is online

        Users browsing this forum: No registered users and 12 guests