方法一:
SELECT ' CREATE SEQUENCE '||SEQUENCE_NAME|| ' INCREMENT BY '||
INCREMENT_BY ||' START WITH '||LAST_NUMBER||' MAXVALUE '||
MAX_VALUE ||' CACHE '||CACHE_SIZE||' ORDER NOCYCLE ;'
FROM user_SEQUENCES;
结果类似:
CREATE SEQUENCE ARTCOMMENT_SEQ INCREMENT BY 1 START WITH 341 MAXVALUE 999999999999999999999999999 CACHE 20 ORDER NOCYCLE ;
CREATE SEQUENCE ARTICLEVISTCECOLLECT_SEQ INCREMENT BY 1 START WITH 1 MAXVALUE 999999999999999999999999999 CACHE 20 ORDER NOCYCLE ;
CREATE SEQUENCE ARTICLEVISTTEMP_SEQ INCREMENT BY 1 START WITH 82989 MAXVALUE 999999999999999999999999999 CACHE 20 ORDER NOCYCLE ;
CREATE SEQUENCE ARTICLEVIST_SEQ INCREMENT BY 1 START WITH 1675 MAXVALUE 999999999999999999999999999 CACHE 20 ORDER NOCYCLE ;
CREATE SEQUENCE ARTICLE_SEQ INCREMENT BY 1 START WITH 1908 MAXVALUE 999999999999999999999999999 CACHE 20 ORDER NOCYCLE ;
方法二:
select dbms_metadata.get_ddl('SEQUENCE',u.object_name) from user_objects u where object_type='SEQUENCE'
结果类似:
CREATE SEQUENCE "MO_VO"."ARTCOMMENT_SEQ" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 341 CACHE 20 ORDER NOCYCLE ;
CREATE SEQUENCE "MO_VO"."ARTICLEVISTCECOLLECT_SEQ" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 ORDER NOCYCLE ;
CREATE SEQUENCE "MO_VO"."ARTICLEVISTTEMP_SEQ" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 82989 CACHE 20 ORDER NOCYCLE ;
CREATE SEQUENCE "MO_VO"."ARTICLEVIST_SEQ" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1675 CACHE 20 ORDER NOCYCLE ;