Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Export Sequences from a database

RE: Export Sequences from a database

From: Jamadagni, Rajendra <rajendra.jamadagni_at_espn.com>
Date: Thu, 28 Sep 2000 10:02:18 -0400
Message-Id: <10633.118149@fatcity.com>


Import Sequences with current value ...

SELECT 'DROP SEQUENCE ' || SEQUENCE_NAME || ' ;' from ALL_SEQUENCES
WHERE SEQUENCE_OWNER = <OWNER_NAME>
UNION ALL
select 'CREATE SEQUENCE ' || SEQUENCE_NAME ||
' INCREMENT BY ' || INCREMENT_BY ||
' START WITH ' || to_char(LAST_NUMBER+1) ||
' MINVALUE ' || to_char(MIN_VALUE) ||

Decode(LENGTH(TO_CHAR(MAX_VALUE)), 27, '', ' MAXVALUE ' || TO_CHAR(MAX_VALUE) ) ||

Decode(CYCLE_FLAG, 'N', ' NOCYCLE', 'Y', ' CYCLE' ) || 
Decode(CACHE_SIZE, 0, ' NOCACHE', ' CACHE ' || TO_CHAR(CACHE_SIZE) )  || 
Decode(ORDER_FLAG, 'N', ' NOORDER', 'Y', ' ORDER' ) || ';' 
from ALL_SEQUENCES
where SEQUENCE_OWNER = <OWNER_NAME>

Import Sequences with start value as 1
SELECT 'DROP SEQUENCE ' || SEQUENCE_NAME || ' ;' from ALL_SEQUENCES
WHERE SEQUENCE_OWNER = <OWNER_NAME>
UNION ALL
select 'CREATE SEQUENCE ' || SEQUENCE_NAME ||
' INCREMENT BY ' || INCREMENT_BY ||
' START WITH 1' ||

Decode(LENGTH(TO_CHAR(MAX_VALUE)), 27, '', ' MAXVALUE ' || TO_CHAR(MAX_VALUE) ) ||

Decode(CYCLE_FLAG, 'N', ' NOCYCLE', 'Y', ' CYCLE' ) || 
Decode(CACHE_SIZE, 0, ' NOCACHE', ' CACHE ' || TO_CHAR(CACHE_SIZE) )  || 
Decode(ORDER_FLAG, 'N', ' NOORDER', 'Y', ' ORDER' ) || ';' 
from ALL_SEQUENCES
where SEQUENCE_OWNER = <OWNER_NAME>

HTH
Raj



Rajendra Jamadagni MIS, ESPN Inc.
Rajendra dot Jamadagni at ESPN dot com
QOTD: Any clod can have facts, but having an opinion is an art ! Any opinion expressed here is personal and doesn't reflect that of ESPN Inc.

This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify ESPN at (860) 766-2000 and delete this e-mail message from your computer, Thank you. Received on Thu Sep 28 2000 - 09:02:18 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US