返回值:
存储函数有且仅有一个返回值
存储过程可以有返回值,也可以没有
调用:
函数可以在sql语句中使用,在查询语句中使用,例如: select 函数名(参数) from 表名 ;
过程使用call调用,例如:call 过程名(参数);
过程:
create procedure 过程(
in 过程参数 类型,
out 返回参数 类型
)
begin
select name from user
where id = 过程参数
into 返回参数;
end;
函数:
create function 函数([函数参数[,….]]) returns 返回类型
begin
If(
return (返回的数据)
else
return (返回的数据)
end if;
end;