导出oracle序列
Posted 邬兴亮
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了导出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序列的主要内容,如果未能解决你的问题,请参考以下文章