db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Veaceslav Chicu ...@infologic.fr>
Subject Re: trigger
Date Tue, 08 Nov 2005 16:00:40 GMT
Hello,
thank you for reply

I want an example for:
http://db.apache.org/derby/docs/10.1/devguide/cdevspecial49460.html

a trigger that throws an exception (if it's not difficult an example
with catch also)

best regards,
Slavic

Dag H. Wanvik wrote:
>>>>>>"Veaceslav" == Veaceslav Chicu <cs@infologic.fr> wrote:
> 
> Veaceslav> 
> Veaceslav> where I can read or find examples for triggers?
> 
> Have a look in the Derby Developer's Guide and Derby Reference, here:
> 
> http://db.apache.org/derby/docs/10.1/devguide/cdevspecial27163.html
> http://db.apache.org/derby/docs/10.1/ref/rrefsqlj43125.html
> 
> Dag
> 
> 
> Veaceslav> thank you,
> Veaceslav> Slavic
> Veaceslav> 
> Veaceslav> Veaceslav Chicu wrote:
> Veaceslav> > nobody know?
> Veaceslav> > 
> Veaceslav> > best regards,
> Veaceslav> > Slavic
> Veaceslav> > 
> Veaceslav> > Veaceslav Chicu wrote:
> Veaceslav> > 
> Veaceslav> >>Hello,
> Veaceslav> >>
> Veaceslav> >>how can I do that in derby?:
> Veaceslav> >>CREATE TRIGGER acc.ins_doc NO CASCADE BEFORE INSERT ON acc.doc
> Veaceslav> >>	REFERENCING NEW AS N
> Veaceslav> >>	FOR EACH ROW MODE DB2SQL
> Veaceslav> >>WHEN(
> Veaceslav> >>	SELECT FROM period
> Veaceslav> >>		WHERE state='O' AND
> Veaceslav> >>		N.cdate BETWEEN date_start AND date_end
> Veaceslav> >>) SIGNAL SQLSTATE 'ERRCODE' ('ERR MESSAGE')
> Veaceslav> >>@
> Veaceslav> >>
> Veaceslav> >>another question, can I have 2 or more insert/update statements
in after
> Veaceslav> >>trigger? how I do?
> Veaceslav> >>begin atomic
> Veaceslav> >>	update 1;
> Veaceslav> >>	update 2;
> Veaceslav> >>end
> Veaceslav> >>@
> Veaceslav> >>
> Veaceslav> >>thank you,
> Veaceslav> >>Slavic
> Veaceslav> >>
> Veaceslav> > 
> Veaceslav> > 
> Veaceslav> > 
> Veaceslav> 


Mime
View raw message