首页 > 数据库技术 > 详细

导出oracle序列

时间:2017-02-13 16:35:02      阅读:255      评论:0      收藏:0      [点我收藏+]

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序列

原文:http://www.cnblogs.com/wuxl360/p/6394314.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!