From teiid-commits at lists.jboss.org Tue Oct 19 12:58:42 2010
Content-Type: multipart/mixed; boundary="===============3766182234213809909=="
MIME-Version: 1.0
From: teiid-commits at lists.jboss.org
To: teiid-commits at lists.jboss.org
Subject: [teiid-commits] teiid SVN: r2661 -
branches/7.1.x/documentation/reference/src/main/docbook/en-US/content.
Date: Tue, 19 Oct 2010 12:58:41 -0400
Message-ID: <201010191658.o9JGwfAB022652@svn01.web.mwc.hst.phx2.redhat.com>
--===============3766182234213809909==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: shawkins
Date: 2010-10-19 12:58:41 -0400 (Tue, 19 Oct 2010)
New Revision: 2661
Modified:
branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/pr=
ocedures.xml
Log:
TEIID-1294 doc updates for procedure validation changes
Modified: branches/7.1.x/documentation/reference/src/main/docbook/en-US/con=
tent/procedures.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/p=
rocedures.xml 2010-10-19 15:47:14 UTC (rev 2660)
+++ branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/p=
rocedures.xml 2010-10-19 16:58:41 UTC (rev 2661)
@@ -108,7 +108,7 @@
Example Assignment
EXECUTE STRING <expression> AS x string =
INTO #temp; =
-DECLARE string VARIABLES.RESULT =3D SEELCT x FROM #temp;
+DECLARE string VARIABLES.RESULT =3D (SELECT x FROM #temp);
@@ -178,11 +178,15 @@
The VARIABLES group is always implied even if it is not sp=
ecified.
+
+ The assignment value follows the same rules as for an Assi=
gnment Statement.
+
+ Assignment Statement
- An assignment statement assigns a value to a variable by eithe=
r evaluating an expression or executing a SELECT command that returns a col=
umn value from a single row.
+ An assignment statement assigns a value to a variable by eithe=
r evaluating an expression.
Usage:
<variable reference> =3D <expr=
ession>;
@@ -194,10 +198,21 @@
- VARIABLES.x =3D SELECT Column1 FROM MySchema.MyTable;
+ VARIABLES.x =3D (SELECT Column1 FROM MySchema.MyTable);
+
+ VARIABLES.ROWS_UPDATED =3D INSERT INTO X (COL) VALUES (1);
+
+
+
+ VARIABLES.x =3D EXEC proc();
+
+
+ Teiid will accept assignments in the form of "var =3D co=
mmand", such is shown above with the INSERT and the EXEC. =
+ However these are truly not expression values and will have alternat=
ive syntax in subsequent releases. =
+ An assignment directly using a EXEC is only valid if the procedure h=
as a return value.If Statement
@@ -282,8 +297,8 @@
the procedure. The BEGIN and END keywords are used to denote block
boundaries. Within the body of the procedure, any valid statement may be used.
- The last command statement executed in the procedure will be
- return as the result. The output of that statement must match the
+ There is no explict cursoring or return statement, rather the =
last command statement executed in the procedure that returns a result set =
will be
+ returned as the result. The output of that statement must match the
expected result set and parameters of the procedure. =
@@ -374,30 +389,13 @@
or variables in the procedure.
A virtual procedure call will return a result set just like a=
ny
SELECT, so you can use this in many places you can use a SELECT.
- However, within a virtual procedure itself you cannot always use an
- EXEC directly. Instead, you use the following syntax:
- SELECT * FROM (EXEC ...) AS x
-
- The following are some examples of how you can use the
- results of a virtual procedure call within a virtual procedure
- definition:
-
- LOOP instruction - you can walk through the results and
- do work on a row-by-row basis
-
-
- Assignment instruction - you can run a command and
- set the first column / first row value returned to a variable
-
-
-
- SELECT * INTO #temp FROM (EXEC ...) AS x - yo=
u can
- select the results from a virtual procedure into a temp table,
- which you can then query against as if it were a physical tabl=
e.
-
-
- =
+ Typically you'll use the following syntax:
+ SELECT * FROM (EXEC ...) AS x =
+
+ Limitations
+ Teiid virtual procedures can only be defined in Teiid Designer.=
They also cannot use IN/OUT, OUT, or RETURN paramters and may only return=
1 result set.
+
=
Update Procedures
@@ -427,7 +425,7 @@
...
END
- The CREATE VIRTUAL PROCEDURE line demarcates the beginning of
+ The CREATE PROCEDURE line demarcates the beginning of
the procedure. The BEGIN and END keywords are used to denote block
boundaries. Within the body of the procedure, any valid statement may be used.
@@ -472,13 +470,19 @@
ROWS_UPDATED Variable
- Teiid returns the value of the VARIABLES.ROWS_UPDATED varia=
ble as a response to an update command executed against
+ Teiid returns the value of the integer VARIABLES.ROWS_UPDAT=
ED variable as a response to an update command executed against
the view. Your procedure must set the value that returns
when an application executes an update command against the view, =
which triggers invocation of the update procedure. For
example, if an UPDATE command is issued that affects 5 records, =
the
ROWS_UPDATED should be set appropriately so that the user will
receive '5' for the count of records affected.
+
+ Sample Usage
+
+
=
--===============3766182234213809909==--