How to export sequences using sql

Normally sequences are not exported if we give partial export.

For such cases we can use sql to generate quries for sequence droping and creating

select ‘drop sequence ‘||sequence_name||’;’ from user_sequences where sequence_name like’SEQ_DB%’;

select ‘create sequence ‘||sequence_name||
‘ minvalue ‘|| MIN_VALUE ||
‘ maxvalue ‘|| MAX_VALUE ||
‘ start with ‘||last_number||
‘ increment by ‘|| INCREMENT_BY ||
‘ cache ‘||CACHE_SIZE ||
decode(ORDER_FLAG,’Y’,’ order ‘)||
decode(CYCLE_FLAG,’Y’,’ cycle ‘)||
‘;’

2 Replies to “How to export sequences using sql”

Leave a Reply

Your email address will not be published. Required fields are marked *