Tema: Re: oracle recursive trigger
Autorius: 2x50
Data: 2010-08-12 15:58:35
o trigeris after insert ar before insert?

Beje, is oracle dokumentacijos (priespaskutinis punktas)
Designing Triggers
Use the following guidelines when designing your triggers:

  a.. Use triggers to guarantee that when a specific operation is performed, 
related actions are performed.
  b.. Do not define triggers that duplicate features already built into 
Oracle Database. For example, do not define triggers to reject bad data if 
you can do the same checking through declarative integrity constraints.
  c.. Limit the size of triggers. If the logic for your trigger requires 
much more than 60 lines of PL/SQL code, it is better to include most of the 
code in a stored procedure and call the procedure from the trigger.
  d.. Use triggers only for centralized, global operations that should be 
fired for the triggering statement, regardless of which user or database 
application issues the statement.
  e.. Do not create recursive triggers. For example, creating an AFTER 
UPDATE statement trigger on the Emp_tab table that itself issues an UPDATE 
statement on Emp_tab, causes the trigger to fire recursively until it has 
run out of memory.
  f.. Use triggers on DATABASE judiciously. They are executed for every user 
every time the event occurs on which the trigger is created.

"ledasl" <asai@pastas.lt> wrote in message 
news:i40q6i$af4$1@trimpas.omnitel.net...
> yra table A (id int, reverse int)
>
> daro komanda insert into A (1, 2)
> trigeryje, reikia kad padarytu insert into A(2, 1)
>
> o ciklas gaunasi butent ant to insert into A(2, 1), nes anie duomenys dar 
> nepakomitinti ir nematomi, o sitas insertas vel iskviecia ta pati trigeri.
>
> "Jornada Del Muerto" <agira@TRINTIgmx.co.uk> wrote in message 
> news:i40pm1$9mm$1@trimpas.omnitel.net...
>>    Neesu specas del oraklo, bet su rekursijom teke nemazai susidurt, 
>> logiskai mastant:
>>
>>    1. Jeigu vyksta insert -> aktyvuot triggeri;
>>    2. Trigeris atlieka insert --> GOTO 1.
>>
>>    Tu cia padarai greiciausia amzina cikla, nors nezinau salygu, jei tau 
>> reikia tik 1 lygio triggerio, tai teks mastyti buda tai patikrinti, 
>> kazkokia logika, speju kai insertini su trigeriu kazkoki nauja irasa del 
>> to kad vyko insertas, tas kuriamas irasas igauna kazkoki reference ID to 
>> iraso del kurio suveike triggeris, jeigu taip tai sukurt lentele kurioje 
>> butu tokiu insertinamu reference ID ir tada triggeris tikrinasi per ja ar 
>> ten nera tokio ID, jei randa tai neatlieka inserto ir nutraukia amzina 
>> cikla, o tuos ID poto gali valyt, dar cia tranzakcija nekenktu.
>>
>>
>>
>> "ledasl" <asai@pastas.lt> wrote in message 
>> news:i40nl5$70m$1@trimpas.omnitel.net...
>>> Sveiki,
>>>
>>> ar imanoma ant oracle 10g trigeryje nustatyti kurio lygio rekursijoj jis
>>> yra?
>>> Problema, kad reikia ideti i lentele insert'o metu ideti dar viena 
>>> irasa,
>>> tai darant per insert trigeri gaunasi gilus ciklas iki kol numirsta del 
>>> per
>>> gilios rekursijos.
>>> Kadangi irasa reikia prideti tik viena, zinant rekursijos gyli galima
>>> sustabdyti ir toliau nebeiterpinteti, bet neaisku, kaip gauti kuriam 
>>> dabar
>>> iskvietime tas trigeris yra.
>>> diseiblinti pacio trigerio neleidzia, nei is jo, nei is iskvieciamos
>>> proceduros, ar funkcijos.
>>>
>