Skip to content

Instantly share code, notes, and snippets.

@snaka
Created November 20, 2008 18:32
Show Gist options
  • Save snaka/27133 to your computer and use it in GitHub Desktop.
Save snaka/27133 to your computer and use it in GitHub Desktop.
export sequence from Oracle
set linesize 200
set pagesize 0
set trimspool on
set heading off
set feedback off
spool /tmp/impSeq.sql
select '-- delete sequence' from dual;
select 'DROP SEQUENCE ' || SEQUENCE_NAME || ';' from USER_SEQUENCES;
select '-- create sequence' from dual;
select 'CREATE SEQUENCE ' || SEQUENCE_NAME ||
' START WITH ' || LAST_NUMBER ||
' INCREMENT BY ' || INCREMENT_BY ||
' MINVALUE ' || MIN_VALUE ||
' MAXVALUE ' || MAX_VALUE ||
case CYCLE_FLAG when 'Y' then ' CYCLE' else ' NOCYCLE' end ||
' CACHE ' || CACHE_SIZE || ';'
from USER_SEQUENCES;
select 'quit' from dual;
spool off
quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment