create table s_if_erptransferlog
(jobid varchar2(200) not null,
startdatetime timestamp not null,
enddatetime timestamp not null,
usedtime number(10, 0) not null,
processcount number(22, 0) not null,
result varchar2(40) not null,
errormsg varchar2(400) ,
serial number(38, 0) not null);
comment on table s_if_erptransferlog is '記錄每次處理的結果'
;comment on column s_if_erptransferlog.jobid is 'job唯一標識'
;comment on column s_if_erptransferlog.startdatetime is '開始時間'
;comment on column s_if_erptransferlog.enddatetime is '結束時間'
;comment on column s_if_erptransferlog.usedtime is '所用時間(毫秒)'
;comment on column s_if_erptransferlog.processcount is '處理資料比數,錯誤時預設為一筆。成功記錄所以處理成功的筆數。'
;comment on column s_if_erptransferlog.result is '處理結果:failed,success。'
;comment on column s_if_erptransferlog.errormsg is '出錯訊息'
;comment on column s_if_erptransferlog.serial is '自增長id'
;--建立sequence
create sequence s_if_erptransferlog_s
minvalue 1
maxvalue 999999999999999999999999999
start with 1
increment by 1
nocache;
--建立trigger
create or replace trigger "s_if_erptransferlog_bri1"
before
insert
on s_if_erptransferlog
referencing new as new old as old
for each row
begin
select s_if_erptransferlog_s.nextval
into :new.serial
from dual;
end;
--測試
insert into s_if_erptransferlog
(jobid,
startdatetime,
enddatetime,
usedtime,
processcount,
result,
errormsg
)values
('insertjob',
sysdate,
sysdate,
22222,
5,'success',
'');
Oracle建立序列 sequence
oracle中的序列號顧名思義就是建立乙個序列號,可以在插入或者更新的時候呼叫,相當於是乙個生成器 建立語法 create sequence myse increment by 1 增長度 start with 1 從 增加,就是說下乙個獲取的值從這個值開始 nomaxvalue 不設定最大值 對應...
Oracle建立序列 sequence
oracle 中的序列號顧名思義就是建立乙個序列號,可以在插入或者更新的時候呼叫,相當於是乙個生成器 建立語法 create sequence myse increment by 1 增長度 start with 1 從 增加,就是說下乙個獲取的值從這個值開始 nomaxvalue 不設定最大值 對...
oracle建立SEQUENCE序列
create sequence seq user info id 你建立的序列的名稱 increment by 1 每次自增長1 start with 1 預設id從1開始 maxvalue 99999999 設定序列最大值為8位9 nomaxvalue代表不設定最大值 minvalue 1 設定最...