存储过程
drop procedure if exists temp;
delimiter //
CREATE PROCEDURE temp ()
BEGIN
declare V_RETUR int;
begin
IF EXISTS(SELECT 1 FROM dual where 1=1) then
IF 1=1 then
set V_RETUR = 1;
select V_RETUR;
END if;
END if;
end;
END//
call temp();
函数
drop function if exists hello ;
delimiter //
CREATE FUNCTION hello (s CHAR(20))
RETURNS CHAR(50)
begin
RETURN CONCAT('Hello, ',s,'!');
end//
select hello('admin');