两类存储过程:函数和过程的区别

Calling

Only with CALL

Possible in all SQL commands,

e.g., in SELECT and UPDATE commands.

Return

Can return one or more SELECT

results

Returns a single value

(command RETURN); the data type of the return value must be specified in the declaration with

RETURNS.

Parameters

Value and reference parameters

possible (IN, OUT, INOUT)

Only value parameters allowed,

thus no identification with IN,

etc.

Commands allowed

in the code

All SQL commands, including

SELECT, INSERT, UPDATE, DELETE,

CREATE TABLE

No commands that access tables.

Calling other functions

and procedures

May call other procedures and

functions

May call only functions, not

procedures.

 

It is permitted to have a function and a procedure with the same name, since when
it is called, MySQL can tell whether a function or a procedure is being invoked.

你可能感兴趣的:(function,command,存储,insert,Parameters,reference)