Oracle中创建表,行级触发器,序列
create table TPointManage
(
PointManageSn NUMBER(14) not null, --积分流水号
ghmembersn NUMBER(8), ----总部卡帐户流水号
mpointsum NUMBER(8), ------累计积分
CREATEDBY NUMBER(8), -------创建人
CREATEDON DATE, -------创建时间
LASTUPDATEDBY NUMBER(8), -------修改人
LASTUPDATEDON DATE, --------修改时间
FLAG NCHAR(1) ----是否有效0有效,1注销
)
create or replace trigger TI_PointManage --创建行级触发器
before insert on TPointManage
REFERENCING OLD AS old_value NEW AS
new_value
FOR EACH ROW
when (new_value.PointManageSn is null)
BEGIN
select PointManage_PointManageSn.nextval into :new_value.PointManageSn from dual;
END;
-- Create sequence
create sequence PointManage_PointManageSn
minvalue 1
maxvalue 999999999999999999999999999
start with 1
increment by 1
cache 20;