trigger

Honza Pazdziora adelton na informatics.muni.cz
Úterý Květen 8 14:02:10 CEST 2001


On Tue, May 08, 2001 at 01:22:39PM +0200, Viktor Bulánek wrote:

>  tak jsem si zkousel hrat s triggery a vubec mi to nefunguje. Dokonce ani te

Co to znamena, nefunguje? Projevuje se to treba nejak? Kde se Vase
ocekavani zacnou lisit od reality? Jaka jsou chybova hlaseni? A tak
dale, a tak podobne.

> nto trapny priklad.
> 
> create trigger tr1
>  before
>   insert
>   on pokus
>  for each row
> 
>  begin
>   if inserting then insert into pokus values(1);

Tady Vam chybi end if; coz Vam v Oraclu rekne napriklad user_errors.

>  end;
> 
> ,kde pokus
> create table pokus(a number(1));
> 
> V cem muze byt problem?

A hlavne je to rekl bych nesmyslne, protoze pri insertu delate
v triggeru dalsi insert, coz opet zavola tento trigger a spusti
insert ... cemuz se rika rekurze, ale ta se vetsinou pise tak, aby
nekdy skoncila. :-)

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton na fi.muni.cz | http://www.fi.muni.cz/~adelton/
   .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, DBD::XBase.
------------------------------------------------------------------------


Další informace o konferenci Test