Oracle自增长列
1.建表 ID 必须是 Number(10)
2.建序列
CREATE SEQUENCE SDE.SEQ_THM_XZYS
START WITH 2
MAXVALUE 9999999999999999999999999999
MINVALUE 1
NOCYCLE
CACHE 20
NOORDER;
3.建触发器
create or replace trigger TGI_THM_XZYS_ID
before insert on SDE.THM_XZYS
for each row
begin
select to_char(SDE.SEQ_THM_XZYS.nextval) into:new.ID from sys.dual;
end;
/
ALTER TRIGGER TGI_THM_XZYS_ID COMPILE;
commit;