MySQL 5.0 FAQ: Stored Procedures and Functions
2873
B.4.12: Do stored procedures have a statement for raising application errors?
Not in MySQL 5.0. The SQL standard
SIGNAL
and
RESIGNAL
statements are implemented in MySQL
5.5.
B.4.13: Do stored procedures provide exception handling?
MySQL implements
HANDLER
definitions according to the SQL standard. See
Section 13.6.7.2,
“
DECLARE ... HANDLER
Syntax”
, for details.
B.4.14: Can MySQL 5.0 stored routines return result sets?
Stored procedures can, but stored functions cannot. If you perform an ordinary
SELECT
inside a stored
procedure, the result set is returned directly to the client. You need to use the MySQL 4.1 (or above)
client/server protocol for this to work. This means that—for instance—in PHP, you need to use the
mysqli
extension rather than the old
mysql
extension.
B.4.15: Is
WITH RECOMPILE
supported for stored procedures?
Not in MySQL 5.0.
B.4.16: Is there a MySQL equivalent to using
mod_plsql
as a gateway on Apache to talk
directly to a stored procedure in the database?
There is no equivalent in MySQL 5.0.
B.4.17: Can I pass an array as input to a stored procedure?
Not in MySQL 5.0.
B.4.18: Can I pass a cursor as an
IN
parameter to a stored procedure?
In MySQL 5.0, cursors are available inside stored procedures only.
B.4.19: Can I return a cursor as an
OUT
parameter from a stored procedure?
In MySQL 5.0, cursors are available inside stored procedures only. However, if you do not open a
cursor on a
SELECT
, the result will be sent directly to the client. You can also
SELECT INTO
variables.
See
Section 13.2.8, “
SELECT
Syntax”
.
B.4.20: Can I print out a variable's value within a stored routine for debugging purposes?
Yes, you can do this in a stored procedure, but not in a stored function. If you perform an ordinary
SELECT
inside a stored procedure, the result set is returned directly to the client. You will need to use
the MySQL 4.1 (or above) client/server protocol for this to work. This means that—for instance—in
PHP, you need to use the
mysqli
extension rather than the old
mysql
extension.
B.4.21: Can I commit or roll back transactions inside a stored procedure?
Yes. However, you cannot perform transactional operations within a stored function.
B.4.22: Do MySQL 5.0 stored procedures and functions work with replication?
Yes, standard actions carried out in stored procedures and functions are replicated from a master
MySQL server to a slave server. There are a few limitations that are described in detail in
Section 18.6,
“Binary Logging of Stored Programs”
.
B.4.23: Are stored procedures and functions created on a master server replicated to a slave?
Yes, creation of stored procedures and functions carried out through normal DDL statements on a
master server are replicated to a slave, so the objects will exist on both servers.
ALTER
and
DROP
statements for stored procedures and functions are also replicated.
B.4.24: How are actions that take place inside stored procedures and functions replicated?
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...