1. 程式人生 > >Oracle查詢所有序列

Oracle查詢所有序列

識別 package enc sel ron oracle ner 管理 序列

註意事項:

  1. 必須以管理員身份登錄;
  2. sequence_owner必須為大寫,不管你的用戶名是否大寫。只有大寫才能識別。
--查看當前用戶的所有序列    
select SEQUENCE_OWNER,SEQUENCE_NAME from dba_sequences where sequence_owner=‘用戶名‘;   

--查詢當前用戶的序列總數    
select count(*) from dba_sequences where sequence_owner=‘用戶名‘;   

--示例:    
select SEQUENCE_OWNER,SEQUENCE_NAME from dba_sequences  where sequence_owner=’WGB;   

select count(*) from dba_sequences where sequence_owner=’ WGB’;  

SQL> select SEQUENCE_OWNER,SEQUENCE_NAME from dba_sequences where sequence_owner=‘CHES‘;
SEQUENCE_OWNER          SEQUENCE_NAME
--------------------   ---------------------------
CHES                CHE_PACKAGE_SEQ
CHES                CHE_PART_SEQ
CHES                CHE_SCHEDULE_SEQ
CHES                CHE_TYPE_SEQ

SQL> select count(*) from dba_sequences where sequence_owner=‘CHES‘;     
COUNT(*)   
----------    
 4  

Oracle查詢所有序列