db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag H. Wanvik" <Dag.Wan...@Sun.COM>
Subject Re: trigger
Date Tue, 08 Nov 2005 13:15:44 GMT

>>>>> "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> 
-- 
Dag H. Wanvik
Sun Microsystems, Web Services, Database Technology Group
Haakon VII gt. 7b, N-7485 Trondheim, Norway
Tel: x43496/+47 73842196, Fax:  +47 73842101

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
NOTICE: This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply email and destroy all copies of the original
message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

Mime
View raw message