-- Create table
create table CLIENTDICTIONARYCMD
(
序号 NUMBER not null,
本次运行唯一标识 VARCHAR2(100) not null,
科力自动生成命令编号 NUMBER not null,
客户端传来命令编号 NUMBER not null,
客户端唯一标识 VARCHAR2(100) not null,
下发时间 DATE not null
)
--创建序列
create sequence SEQ_CLIENTDICTIONARYCMD
minvalue 1
nomaxvalue
start with 1
increment by 1
nocache;
--创建触发器
create or replace trigger tri_CLIENTDICTIONARYCMD
before insert on CLIENTDICTIONARYCMD
for each row
declare
nextid number;
begin
IF :new.序号 IS NULL or :new.序号=0 THEN
select SEQ_CLIENTDICTIONARYCMD.nextval
into nextid
from sys.dual;
:new.序号:=nextid;
end if;
end tri_CLIENTDICTIONARYCMD;