DELETE
Syntax
1060
In prepared
CALL
statements used with
PREPARE
and
EXECUTE
, placeholder support is available in
MySQL 5.0 for
IN
parameters, but not for
OUT
or
INOUT
parameters. To work around this limitation
for
OUT
and
INOUT
parameters, to forgo the use of placeholders: Refer to user variables in the
CALL
statement itself and do not specify them in the
EXECUTE
statement:
mysql>
SET @increment = 10;
mysql>
PREPARE s FROM 'CALL p(@version, @increment)';
mysql>
EXECUTE s;
mysql>
SELECT @version, @increment;
+-----------------+------------+
| @version | @increment |
+-----------------+------------+
| 6.0.7-alpha-log | 11 |
+-----------------+------------+
To write C programs that use the
CALL
SQL statement to execute stored procedures that produce
result sets, the
CLIENT_MULTI_RESULTS
flag must be enabled. This is because each
CALL
returns
a result to indicate the call status, in addition to any result sets that might be returned by statements
executed within the procedure.
CLIENT_MULTI_RESULTS
must also be enabled if
CALL
is used to
execute any stored procedure that contains prepared statements. It cannot be determined when such
a procedure is loaded whether those statements will produce result sets, so it is necessary to assume
that they will.
CLIENT_MULTI_RESULTS
can be enabled when you call
mysql_real_connect()
,
either explicitly by passing the
CLIENT_MULTI_RESULTS
flag itself, or implicitly by passing
CLIENT_MULTI_STATEMENTS
(which also enables
CLIENT_MULTI_RESULTS
).
To process the result of a
CALL
statement executed using
mysql_query()
or
mysql_real_query()
, use a loop that calls
mysql_next_result()
to determine whether
there are more results. For an example, see
Section 20.6.15, “C API Support for Multiple Statement
Execution”
.
For programs written in a language that provides a MySQL interface, there is no native method for
directly retrieving the results of
OUT
or
INOUT
parameters from
CALL
statements. To get the parameter
values, pass user-defined variables to the procedure in the
CALL
statement and then execute a
SELECT
statement to produce a result set containing the variable values. To handle an
INOUT
parameter, execute a statement prior to the
CALL
that sets the corresponding user variable to the value
to be passed to the procedure.
The following example illustrates the technique (without error checking) for the stored procedure
p
described earlier that has an
OUT
parameter and an
INOUT
parameter:
mysql_query(mysql, "SET @increment = 10");
mysql_query(mysql, "CALL p(@version, @increment)");
mysql_query(mysql, "SELECT @version, @increment");
result = mysql_store_result(mysql);
row = mysql_fetch_row(result);
mysql_free_result(result);
After the preceding code executes,
row[0]
and
row[1]
contain the values of
@version
and
@increment
, respectively.
13.2.2.
DELETE
Syntax
Single-table syntax:
DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM
tbl_name
[WHERE
where_condition
]
[ORDER BY ...]
[LIMIT
row_count
]
Multiple-table syntax:
DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
tbl_name
[.*] [,
tbl_name
[.*]] ...
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...