首页 > 代码库 > 导出oracle序列
导出oracle序列
set serveroutput on;
spool c:\sequence_code.txt;
declare
v_sequence varchar2(4000);
v_nextval number(38,0);
begin
for i in (select sequence_name from user_sequences) loop
select dbms_metadata.get_ddl(‘SEQUENCE‘,i.sequence_name,user) into v_sequence from dual;
execute immediate ‘select ‘||i.sequence_name||‘.‘||‘nextval from dual‘ into v_nextval;
v_sequence := substr(v_sequence,1,instr(v_sequence,‘START WITH‘,1,1)+length(‘START WITH‘))||‘ ‘||to_char(v_nextval)||‘ ‘||
substr(v_sequence,instr(v_sequence,‘CACHE‘))||‘;‘;
dbms_output.put_line(v_sequence);
end loop;
end;
/
spool off;
导出oracle序列
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。