标签:under global mysql导入 use rom span tab end color
–创建自增表
CREATE TABLE biz_tb_sequence ( NAME VARCHAR ( 50 ) NOT NULL, current_value INT NOT NULL, _increment INT NOT NULL DEFAULT 1, PRIMARY KEY ( NAME ) );
–向mysql导入函数的时候,报错执行下方sql
set global log_bin_trust_function_creators=TRUE;
–创建函数
create function _nextval(n varchar(50)) returns integer
begin
declare _cur int;
set _cur=(select current_value from biz_tb_sequence where name= n);
update biz_tb_sequence
set current_value = _cur + _increment
where name=n ; 郑州看胎记哪个医院好 http://m.zykdbh.com/
return _cur;
end;
123456789
–测试
select _nextval(‘user_id‘);
参考:
https://blog.csdn.net/zhezhebie/article/details/81453394
https://www.cnblogs.com/husam/p/5333568.html
标签:under global mysql导入 use rom span tab end color
原文地址:https://www.cnblogs.com/12man/p/13432063.html