Oracle中一个简单的Sequence
CREATE TABLE TB_GH_YMSCLFYTZ_DATA
(
N_XH NUMBER(24),
C_NF VARCHAR2(4 BYTE),
C_XM VARCHAR2(100 BYTE),
N_JANUARY NUMBER(24,2),
N_FEBRUARY NUMBER(24,2),
N_MARCH NUMBER(24,2),
N_APRIL NUMBER(24,2),
N_MAY NUMBER(24,2),
N_JUN NUMBER(24,2),
N_JULY NUMBER(24,2),
N_AUGUST NUMBER(24,2),
N_SEPTEMBER NUMBER(24,2),
N_OCTOBER NUMBER(24,2),
N_NOVEMBER NUMBER(24,2),
N_DECEMBER NUMBER(24,2),
N_FIRSTQUARTER NUMBER(24,2),
N_SECONDQUARTER NUMBER(24,2),
N_THIRDQUARTER NUMBER(24,2),
N_FOURTHQUARTER NUMBER(24,2),
N_FULLYEAR NUMBER(24,2),
C_BZ VARCHAR2(200 BYTE),
D_LRSJ DATE,
C_LRR VARCHAR2(50 BYTE)
)
TABLESPACE SCERP
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCACHE
NOPARALLEL
NOMONITORING;
CREATE SEQUENCE SCDBA.TB_GH_YMSCLFYTZ_XH_SEQ
CREATE OR REPLACE TRIGGER TB_GH_YMSCLFYTZ_XH_TRIG BEFORE INSERT ON TB_GH_YMSCLFYTZ_DATA FOR EACH ROW
begin
select TB_GH_YMSCLFYTZ_XH_SEQ.nextval into :new.N_XH from dual;
end;