Oracle 主键设置自增策略

-- 创建自增序列
CREATE SEQUENCE seq_interface_info
INCREMENT BY 1    
START WITH 1  --从1开始  
NOMAXVALUE    --不设最大值  
NOCYCLE       --不循环  
NOCACHE;  
-- 创建表interface_info的触发器
CREATE TRIGGER interface_info_trigger   
BEFORE INSERT    --  
ON interface_info
FOR EACH ROW  
BEGIN  
  SELECT seq_interface_info.nextval   
  INTO:new.api_id  FROM dual;  
END;  
--创建表interface_release的触发器
CREATE TRIGGER interface_release_trigger   
BEFORE INSERT    --  
ON interface_release
FOR EACH ROW  
BEGIN  
  SELECT seq_interface_info.nextval   
  INTO:new.pub_id  FROM dual;  
END;