• As of MySQL 5.0.8, truncate operations cause an implicit commit. Before 5.0.8, truncate operations
are not transaction-safe; an error occurs when attempting one in the course of an active transaction.
• Truncation operations cannot be performed if the session holds an active table lock.
• Truncation operations do not return a meaningful value for the number of deleted rows. The usual
result is "0 rows affected," which should be interpreted as "no information."
• As long as the table format file
table with
• The table handler does not remember the last used
from the beginning. This is true even for
sequence values.
• Since truncation of a table does not make any use of DELETE, the
does not invoke
13.2. Data Manipulation Statements
13.2.1.
Syntax
CALL
CALL sp_name([parameter[,...]])
CALL sp_name[()]
The
statement invokes a stored procedure that was defined previously with
CALL
PROCEDURE.
As of MySQL 5.0.30, stored procedures that take no arguments can be invoked without parentheses.
That is,
CALL p()
can pass back values to its caller using parameters that are declared as
CALL
parameters. When the procedure returns, a client program can also obtain the number of rows affected
for the final statement executed within the routine: At the SQL level, call the
function; from the C API, call the
To get back a value from a procedure using an
means of a user variable, and then check the value of the variable after the procedure returns. (If you
are calling the procedure from within another stored procedure or function, you can also pass a routine
parameter or local routine variable as an
its value before passing it to the procedure. The following procedure has an
procedure sets to the current server version, and an
one from its current value:
CREATE PROCEDURE p (OUT ver_param VARCHAR(25), INOUT incr_param INT)
BEGIN
# Set value of OUT parameter
SELECT VERSION() INTO ver_param;
# Increment value of INOUT parameter
SET incr_param = incr_param + 1;
END;
Before calling the procedure, initialize the variable to be passed as the
the procedure, the values of the two variables will have been set or modified:
mysql>
SET @increment = 10;
mysql>
CALL p(@version, @increment);
mysql>
SELECT @version, @increment;
+------------+------------+
| @version
+------------+------------+
| 5.0.25-log | 11
+------------+------------+
Data Manipulation Statements
tbl_name.frm
TABLE, even if the data or index files have become corrupted.
TRUNCATE
triggers.
ON DELETE
and
are equivalent.
CALL p
mysql_affected_rows()
| @increment |
|
is valid, the table can be re-created as an empty
AUTO_INCREMENT
and InnoDB, which normally do not reuse
MyISAM
function.
or
parameter, pass the parameter by
OUT
INOUT
or
parameter.) For an
IN
INOUT
value that the procedure increments by
INOUT
1059
value, but starts counting
statement
TRUNCATE TABLE
CREATE
or
OUT
INOUT
[963]
ROW_COUNT()
parameter, initialize
INOUT
parameter that the
OUT
parameter. After calling
INOUT
Need help?
Do you have a question about the 5.0 and is the answer not in the manual?
Questions and answers