Oracle query table table, index index, sequence sequence, whether the trigger exists

Table:

select count(*) from dba_tables where owner = 'ZHZ' and table_name = 'TEST'

Some schemas cannot query dba_tables, just use the following table query

select count(*) from user_tables where table_name = 'TEST'

Note that Owner and table name need to be capitalized

Index:

SELECT COUNT(*) FROM ALL_INDEXES where table_name = 'TEST' and index_name = 'TEST_INDEX'

Some schemas cannot query ALL_INDEXES, just use the following table query

SELECT COUNT(*) FROM USER_INDEXES where table_name = 'TEST' and index_name = 'TEST_INDEX';

 

Sequence:

select COUNT(*) from user_sequences where sequence_name = 'TEST_SEQ' and user = 'ZHZ';

 

Trigger:

select count(*) from user_triggers where trigger_name='TR_TEST' and user = 'ZHZ'

Guess you like

Origin blog.csdn.net/weixin_42488909/article/details/114140394