oracle自动编号方法

 CREATE TABLE aaa (
      id number(11) NOT NULL ,
      hmfcname varchar2(100),
      picture varchar2(255));


CREATE UNIQUE INDEX aaa_id_index ON aaa(id);


      CREATE SEQUENCE aaa_id_seq start with 1 increment by 1 maxvalue
      2147483647 minvalue 1 cache 10 ;


      CREATE OR REPLACE TRIGGER aaa_id_trigger
      BEFORE INSERT ON aaa REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW
      BEGIN
      SELECT aaa_id_seq.NEXTVAL INTO :NEW.id FROM DUAL;
      END;

你可能感兴趣的:(oracle自动编号方法)