MySQL Query Browser下创建存储过程和自定义函数

babyZeng 2011-12-14

写MySQL,写了两个简单的

简单的存储过程:

DELIMITER $$
DROP PROCEDURE IF EXISTS wy_proc $$
CREATE PROCEDURE wy_proc (IN tname varchar(50),out outvalue datetime)
begin
set outvalue = CAST('1858-11-17' as datetime);
select outvalue;
END $$
DELIMITER ;

简单的函数:

DELIMITER $$
DROP FUNCTION IF EXISTS wy_fun $$
CREATE FUNCTION wy_fun (num varchar(50)) RETURNS datetime
begin
declare outvalue datetime;
set outvalue = CAST('1858-11-17' as datetime);
RETURN outvalue;
END $$
DELIMITER ;

相关推荐