oracle自增id

--表名=jia_base
--创建序列
create sequence jia_base_autoId
increment by 1
start with 1
maxvalue 999999 cycle; 

--创建触发器
create or replace trigger tr_jia_base
before insert on jia_base
for each row
begin
select jia_base_autoId.nextval into :new.id from dual;
end;

===================

查询用户下说有的 sequence(用户名大写)

select SEQUENCE_OWNER,SEQUENCE_NAME from dba_sequences where sequence_owner='JIA'; 

 

 

你可能感兴趣的:(oracle)