赞
踩
首先创建表:
- CREATE TABLE `sys_sequence` (
- `NAME` varchar(50) NOT NULL,
- `CURRENT_VALUE` int(11) NOT NULL DEFAULT '0',
- `INCREMENT` int(11) NOT NULL DEFAULT '1',
- PRIMARY KEY (`NAME`)
- )
INSERT INTO SYS_SEQUENCE(NAME,CURRENT_VALUE,INCREMENT) VALUES('TBL_FS', 1,1)
- DELIMITER $$
-
- DROP FUNCTION IF EXISTS `currval`$$
-
- CREATE DEFINER=`root`@`%` FUNCTION `currval`(seq_name VARCHAR(50)) RETURNS INT(11)
- BEGIN
- DECLARE VALUE INTEGER;
- SET VALUE=0;
- SELECT current_value INTO VALUE
- FROM sys_sequence
- WHERE NAME=seq_name;
- RETURN VALUE;
- END$$
-
- DELIMITER ;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。