1.動態(tài)創(chuàng)建自動增長的序列:
declare
v_sql varchar2(1000);
v_num number(20):=1;
begin
v_sql:='create sequence sqbs ';-
select max(sqb.id)+1 into v_num from sqb;
if v_num is null then v_num :=1;
v_sql:=v_sql||' maxvalue 999999 start with '||v_num ||' increment by 1 nocache';
end if;
execute immediate v_sql;
end;
2--創(chuàng)建序列
create sequence t
--使用序列
select t.nextval from dual --獲取下一個序列值
select t.currval from dual --獲取當前序列值
drop sequence g --刪除序列
alter sequence ttt increment by -3--修改序列
本文出自:億恩科技【www.allwellnessguide.com】
服務器租用/服務器托管中國五強!虛擬主機域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]
|