You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by bp...@apache.org on 2006/11/12 17:08:09 UTC
svn commit: r473979 - /db/derby/docs/trunk/src/ref/rrefsqlj43125.dita
Author: bpendleton
Date: Sun Nov 12 08:08:09 2006
New Revision: 473979
URL: http://svn.apache.org/viewvc?view=rev&rev=473979
Log:
DERBY-1953: Make FOR EACH and MODE DB2SQL optional in CREATE TRIGGER
This patch was contributed by Yip Ng (yipng168@gmail.com)
This patch updates the ref manual - CREATE TRIGGER syntax and examples to
indicate that [ FOR EACH { ROW | STATEMENT } ] and [ MODE DB2SQL ] are
now optional, and that STATEMENT is the default if FOR EACH is not specified.
Modified:
db/derby/docs/trunk/src/ref/rrefsqlj43125.dita
Modified: db/derby/docs/trunk/src/ref/rrefsqlj43125.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefsqlj43125.dita?view=diff&rev=473979&r1=473978&r2=473979
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsqlj43125.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefsqlj43125.dita Sun Nov 12 08:08:09 2006
@@ -53,7 +53,7 @@
{ INSERT | DELETE | UPDATE [ OF <i>column-Name</i> [, <i><xref href="rrefcolumnname.dita#rrefcolumnname">column-Name</xref></i>]* ] }
ON <i><xref href="rreftablename.dita#rreftablename">table-Name</xref></i>
[ <i><xref href="rrefsqlj89752.dita#rrefsqlj89752">ReferencingClause</xref></i> ]
-FOR EACH { ROW | STATEMENT } MODE DB2SQL
+[ FOR EACH { ROW | STATEMENT } ] [ MODE DB2SQL ]
<i><xref href="rrefsqlj43125.dita#rrefsqlj43125/i1149821">Triggered-SQL-statement</xref></i></b></codeblock> </refsyn>
<section><title>Before or after: when triggers fire</title> <p>Triggers are
defined as either <i>Before</i> or <i>After</i> triggers. <ul>
@@ -107,7 +107,9 @@
for a transition table and statement triggers cannot designate a correlation
for transition variables. </p> </section>
<section id="sqlj54276"><title>Statement versus row triggers</title> <p>You
-must specify whether a trigger is a <i>statement trigger</i> or a <i>row trigger</i>:
+have the option to specify whether a trigger is a <i>statement trigger</i> or a <i>row trigger</i>.
+If it is not specified in the CREATE TRIGGER statement via FOR EACH clause, then the trigger is
+a <i>statement trigger</i> by default.
<ul>
<li><i>statement triggers</i> <p>A statement trigger fires once per triggering
event and regardless of whether any rows are modified by the insert, update,
@@ -159,14 +161,14 @@
CREATE TRIGGER FLIGHTSDELETE
AFTER DELETE ON FLIGHTS
REFERENCING OLD_TABLE AS DELETEDFLIGHTS
- FOR EACH STATEMENT MODE DB2SQL
+ FOR EACH STATEMENT
DELETE FROM FLIGHTAVAILABILITY WHERE FLIGHT_ID IN
(SELECT FLIGHT_ID FROM DELETEDFLIGHTS);
CREATE TRIGGER FLIGHTSDELETE3
AFTER DELETE ON FLIGHTS
REFERENCING OLD AS OLD
- FOR EACH ROW MODE DB2SQL
+ FOR EACH ROW
DELETE FROM FLIGHTAVAILABILITY WHERE FLIGHT_ID = OLD.FLIGHT_ID;
</b></codeblock> <note>You can find more examples in the <cite><ph conref="refconrefs.dita#pub/citdevelop"></ph></cite>.</note> </example>
<section><title>Trigger recursion</title> <p>The maximum trigger recursion