Parameters
Standards and
compatibility
Examples
USING clause
Results from a SELECT statement or a CALL statement
are put into either the variables in the variable list or the program data areas
described by the named SQLDA. The correspondence is one-to-one from the
OUTPUT (selection list or parameters) to either the host variable list or the
SQLDA descriptor array.
INTO clause
If EXECUTE INTO is used with an INSERT statement, the
inserted row is returned in the second descriptor. For example, when using
auto-increment primary keys or BEFORE INSERT triggers that generate
primary key values, the EXECUTE statement provides a mechanism to re-
fetch the row immediately and determine the primary key value that was
assigned to the row. The same thing can be achieved by using @@identity
with auto-increment keys.
ARRAY clause
The optional ARRAY clause can be used with prepared
INSERT statements to allow wide inserts, which insert more than one row at
a time and which may improve performance. The integer value is the number
of rows to be inserted. The SQLDA must contain a variable for each entry
(number of rows * number of columns). The first row is placed in SQLDA
variables 0 to (columns per row)-1, and so on.
♦
Intermediate level feature.
SQL/92
♦
Sybase
Supported in Open Client/Open Server.
♦
Execute a DELETE.
EXEC SQL EXECUTE IMMEDIATE
'DELETE FROM employee WHERE emp_id = 105';
♦
Execute a prepared DELETE statement.
EXEC SQL PREPARE del_stmt FROM
'DELETE FROM employee WHERE emp_id = :a';
EXEC SQL EXECUTE del_stmt USING :employee_number;
♦
Execute a prepared query.
EXEC SQL PREPARE sel1 FROM
'SELECT emp_lname FROM employee WHERE emp_id = :a';
EXEC SQL EXECUTE sel1 USING :employee_number INTO
:emp_lname;
Chapter 9 SQL Statements
515
Need help?
Do you have a question about the Adaptive Server Anywhere and is the answer not in the manual?
Questions and answers