1.创建表
create table test ( id NUMBER, messageid VARCHAR2(32) );
2.创建序列
create sequence test_id minvalue 1 maxvalue 9999999 start with 1 increment by 1 cache 50;
3.创建触发器
CREATE OR REPLACE TRIGGER "test_auto_id" BEFORE INSERT ON recv_msg REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW DECLARE BEGIN SELECT test_id.NEXTVAL INTO :NEW.ID FROM DUAL; END recv_trig;
原文地址:https://www.cnblogs.com/zmdd/p/8945120.html
时间: 2024-10-13 00:08:33