oracle的序列变成MysqL的 : MysqL 创建一个表 并创建一个函数即可
oracle:
-- Create sequence
create sequence CHATACTIVITY_SEQ
minvalue 1
maxvalue 9999999999999999999999999999
start with 52373
increment by 1
cache 20;
DROP TABLE IF EXISTS `chatactivity_seq`;
CREATE TABLE `chatactivity_seq` (
`stub` char(1) DEFAULT NULL,
`id` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `stub` (`stub`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of chatactivity_seq
-- ----------------------------
INSERT INTO `chatactivity_seq` VALUES ('a','1');
。。。。。。。。。。。。。建函数
CREATE FUNCTION chatactivity_seq() RETURNS bigint(20) BEGIN REPLACE INTO chatactivity_seq(stub) VALUES ('a'); RETURN (SELECT LAST_INSERT_ID() from dual); END;