查询数据库的SEQUENCES(序列)

查询自增主键序列

1.查询所有的序列的start with

SELECT 'CREATE SEQUENCE ' || SEQUENCE_NAME || ' MINVALUE ' || MIN_VALUE ||
       ' MAXVALUE ' || MAX_VALUE || ' START WITH ' || LAST_NUMBER ||
       ' INCREMENT BY ' || INCREMENT_BY ||(CASE
         WHEN CACHE_SIZE = 0 THEN
          ' NOCACHE'
         ELSE
          ' CACHE ' ||CACHE_SIZE
       END)||';'
  FROM USER_SEQUENCES

2.查询某个表是否存在序列

SELECT SEQ_PRODUCT_DRAFT.nextval FROM ad_resigned_log

3.查询当前用户的所有序列

select * from user_sequences;

4.

猜你喜欢

转载自blog.csdn.net/qq_31450641/article/details/116134644

相关文章