Oracle 5.0 Reference Manual page 1046

Table of Contents

Advertisement

CREATE PROCEDURE
| hello('world') |
+----------------+
| Hello, world!
|
+----------------+
1 row in set (0.00 sec)
Parameter types and function return types can be declared to use any valid data type, except that the
attribute cannot be used.
COLLATE
The
consists of a valid SQL routine statement. This can be a simple statement
routine_body
such as
or INSERT, or a compound statement written using
SELECT
statements can contain declarations, loops, and other control structure statements. The syntax for
these statements is described in
MySQL permits routines to contain DDL statements, such as
stored procedures (but not stored functions) to contain SQL transaction statements such as COMMIT.
Stored functions may not contain statements that perform explicit or implicit commit or rollback. Support
for these statements is not required by the SQL standard, which states that each DBMS vendor may
decide whether to permit them.
Statements that return a result set can be used within a stored procedure but not within a stored
function. This prohibition includes
and other statements such as SHOW, EXPLAIN, and
determined at function definition time to return a result set, a
set from a function
determined only at runtime to return a result set, a
in the given context
Note
Before MySQL 5.0.10, stored functions created with
not contain references to tables, with limited exceptions. They may include
some
(SELECT MAX(id) FROM
directly into variables, for example
statements within stored routines are not permitted. When a routine is invoked, an implicit
USE
is performed (and undone when the routine terminates). This causes the routine to have the
db_name
given default database while it executes. References to objects in databases other than the routine
default database should be qualified with the appropriate database name.
For additional information about statements that are not permitted in stored routines, see
"Restrictions on Stored
For information about invoking stored procedures from within programs written in a language that has a
MySQL interface, see
Section 13.2.1,
MySQL stores the
sql_mode
created, and always executes the routine with this setting in force, regardless of the server SQL mode
in effect when the routine is invoked.
The switch from the SQL mode of the invoker to that of the routine occurs after evaluation of arguments
and assignment of the resulting values to routine parameters. If you define a routine in strict SQL mode
but invoke it in nonstrict mode, assignment of arguments to routine parameters does not take place in
strict mode. If you require that expressions passed to a routine be assigned in strict SQL mode, you
should invoke the routine with strict mode in effect.
The
characteristic is a MySQL extension, and may be used to describe the stored routine.
COMMENT
This information is displayed by the
statements.
The
characteristic indicates the language in which the routine is written. The server ignores
LANGUAGE
this characteristic; only SQL routines are supported.
and
CREATE FUNCTION
Section 13.6, "MySQL Compound-Statement
statements that do not have an
SELECT
error occurs
(ER_SP_NO_RETSET
error occurs
(ER_SP_BADSELECT
statements that contain table references, for example
SET
Programs".
"CALL
Syntax".
[495]
system variable setting that is in effect at the time a routine is
SHOW CREATE PROCEDURE
1026
Syntax
BEGIN
CREATE
TABLE. For statements that can be
CHECK
Not allowed to return a result
[2937]). For statements that can be
PROCEDURE %s can't return a result set
[2930]).
t), and
statements that fetch values
SELECT
SELECT i INTO var1 FROM
and
SHOW CREATE FUNCTION
and END. Compound
Syntax".
and DROP. MySQL also permits
INTO var_list
CREATE FUNCTION
SET a:=
t.
Section E.1,
clause
must
USE

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents