Difference between revisions of "EXECUTE"
From Lianjapedia
Yvonne.milne (Talk | contribs) |
|||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | ''[[EXECUTE Commands|EXECUTE ... commands]]'' | ||
+ | |||
==Purpose== | ==Purpose== | ||
Executes an SQL statement previously set up using the PREPARE command | Executes an SQL statement previously set up using the PREPARE command | ||
− | |||
==Syntax== | ==Syntax== | ||
EXECUTE <statement> USING :<variable>[,<variable2>[,...]] | EXECUTE <statement> USING :<variable>[,<variable2>[,...]] | ||
− | |||
==See Also== | ==See Also== | ||
[[EXECUTE IMMEDIATE]], [[PREPARE]] | [[EXECUTE IMMEDIATE]], [[PREPARE]] | ||
− | |||
==Description== | ==Description== | ||
The EXECUTE command is used to execute an SQL statement previously set up using the PREPARE command. Variables used as parameters in the SQL statement must be declared before execution. | The EXECUTE command is used to execute an SQL statement previously set up using the PREPARE command. Variables used as parameters in the SQL statement must be declared before execution. | ||
− | + | {| class="wikitable" width="100%" | |
− | + | ||
− | {| class="wikitable" | + | |
!Keywords||Description | !Keywords||Description | ||
|- | |- | ||
Line 26: | Line 23: | ||
|- | |- | ||
|} | |} | ||
− | |||
==Example== | ==Example== | ||
Line 43: | Line 39: | ||
buf1 = '00101' | buf1 = '00101' | ||
− | buf2 = ' | + | buf2 = 'Lianja' |
buf3 = 'US' | buf3 = 'US' | ||
EXECUTE mystmt USING :buf1, :buf2, :buf3 | EXECUTE mystmt USING :buf1, :buf2, :buf3 | ||
</code> | </code> | ||
− | |||
==Products== | ==Products== | ||
− | + | Lianja Server, Lianja | |
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:SQL]] | [[Category:SQL]] | ||
[[Category:Commands]] | [[Category:Commands]] |
Latest revision as of 10:01, 3 August 2016
Purpose
Executes an SQL statement previously set up using the PREPARE command
Syntax
EXECUTE <statement> USING :<variable>[,<variable2>[,...]]
See Also
Description
The EXECUTE command is used to execute an SQL statement previously set up using the PREPARE command. Variables used as parameters in the SQL statement must be declared before execution.
Keywords | Description |
---|---|
statement | An identifier for the SQL statement previously set up using PREPARE |
variable | The name of a variable to be used as the first parameter to the SQL statement |
variable2... | The names of variables to be used as the subsequent parameters to the SQL statement |
Example
stmtbuf = 'SELECT * FROM customers WHERE contactnam = ?' PREPARE mystmt FROM :stmtbuf gcAuthor = 'Ann Devon' EXECUTE mystmt USING :gcAuthor gcAuthor = 'Yang Wang' EXECUTE mystmt USING :gcAuthor stmtbuf = 'INSERT INTO customers (customerid, companynam, contactnam) VALUES (?,?,?)' PREPARE mystmt FROM :stmtbuf buf1 = '00101' buf2 = 'Lianja' buf3 = 'US' EXECUTE mystmt USING :buf1, :buf2, :buf3
Products
Lianja Server, Lianja