标签:bsp var key create incr 序列 varchar value before
--1.创建表
create table Student(
ID integer not null primary key,
Name varchar2(40) not null,
Sex integer,
Address varchar2(100)
)
--2.创建序列
CREATE SEQUENCE 名称
MINVALUE 1
MAXVALUE 999999999
INCREMENT BY 1
START WITH 1
CACHE 20 NOORDER NOCYCLE ;
--3.创建触发器
create OR REPLACE TRIGGER Trigger_StuID
BEFORE insert
ON Student
FOR EACH ROW
BEGIN
if inserting then
if :NEW."ID" is null then
select SEQ_StuID.nextval into :NEW."ID" from dual;
end if;
end if;
END;
标签:bsp var key create incr 序列 varchar value before
原文地址:https://www.cnblogs.com/hu-kang/p/12698717.html