Check if Table, View, Trigger, etc present in Oracle - GeeksforGeeks

10 Jan, 2018
Sometimes while working in SQL we often forget the names of the view or sequence or index or synonyms or trigger we earlier created. Also it may happen that we want to verify them in future.
Verifying means that we are checking for all the present database object or Trigger in that particular schema.This could be done for above all using the below mentioned queries:
PREREQUISITE: DATABASE OBJECTSTriggers
1. verify VIEWS
SYNTAX:SELECT VIEW_NAME FROM USER_VIEWS;

        OR

SELECT * FROM USER_VIEWS;

SELECT VIEW_NAME FROM USER_VIEWS;

        OR

SELECT * FROM USER_VIEWS;

Examples:Input : SELECT VIEW_NAME FROM USER_VIEWS;
Output :
Input : SELECT * FROM USER_VIEWS;
Output :

Input : SELECT VIEW_NAME FROM USER_VIEWS;
Output :

Input : SELECT * FROM USER_VIEWS;
Output :

2. verify SEQUENCES
SYNTAX:SELECT SEQUENCE_NAME FROM USER_SEQUENCES;

        OR

SELECT * FROM USER_SEQUENCES;

SELECT SEQUENCE_NAME FROM USER_SEQUENCES;

        OR

SELECT * FROM USER_SEQUENCES;

Examples:Input : SELECT SEQUENCE_NAME FROM USER_SEQUENCES;
Output :
Input : SELECT * FROM USER_SEQUENCES;
Output :

Input : SELECT SEQUENCE_NAME FROM USER_SEQUENCES;
Output :

Input : SELECT * FROM USER_SEQUENCES;
Output :

3. verify INDEXES
SYNTAX:SELECT INDEX_NAME FROM USER_INDEXES;

        OR

SELECT * FROM USER_INDEXS;

SELECT INDEX_NAME FROM USER_INDEXES;

        OR

SELECT * FROM USER_INDEXS;

Examples:Input : SELECT INDEX_NAME FROM USER_INDEXES;
Output :
Input : SELECT * FROM USER_INDEXES;
Output :

Input : SELECT INDEX_NAME FROM USER_INDEXES;
Output :

Input : SELECT * FROM USER_INDEXES;
Output :

4. verify TABLES
SYNTAX:SELECT TABLE_NAME FROM USER_TABLES;

        OR

SELECT * FROM USER_TABLES;

SELECT TABLE_NAME FROM USER_TABLES;

        OR

SELECT * FROM USER_TABLES;

Examples:Input : SELECT TABLE_NAME FROM USER_TABLES;
Output :
Input : SELECT * FROM USER_TABLES;
Output :

Input : SELECT TABLE_NAME FROM USER_TABLES;
Output :

Input : SELECT * FROM USER_TABLES;
Output :

5. verify SYNONYMS
SYNTAX:SELECT SYNONYM_NAME FROM USER_SYNONYMS;

        OR

SELECT * FROM USER_SYNONYMS;

SELECT SYNONYM_NAME FROM USER_SYNONYMS;

        OR

SELECT * FROM USER_SYNONYMS;

Examples:Input : SELECT SYNONYM_NAME FROM USER_SYNONYMS;
Output : 
Input : SELECT * FROM USER_SYNONYMS;
Output : 

Input : SELECT SYNONYM_NAME FROM USER_SYNONYMS;
Output : 

Input : SELECT * FROM USER_SYNONYMS;
Output : 

6. verify TRIGGERS
SYNTAX:SELECT TRIGGER_NAME FROM USER_TRIGGERS;

        OR

SELECT * FROM USER_TRIGGERS;

SELECT TRIGGER_NAME FROM USER_TRIGGERS;

        OR

SELECT * FROM USER_TRIGGERS;

Examples:Input : SELECT TRIGGER_NAME FROM USER_TRIGGERS;
Output : 
Input : SELECT * FROM USER_TRIGGERS;
Output : 

Input : SELECT TRIGGER_NAME FROM USER_TRIGGERS;
Output : 

Input : SELECT * FROM USER_TRIGGERS;
Output : 

NOTE: Using * means that we need all the attributes for that database object or Trigger to get displayed.
DBMS
GBlog
SQL
DBMS
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Types of Functional dependencies in DBMS
Introduction of Relational Algebra in DBMS
What is Temporary Table in SQL?
KDD Process in Data Mining
Two Phase Locking Protocol
Roadmap to Become a Web Developer in 2022
Must Do Coding Questions for Companies like Amazon, Microsoft, Adobe, ...
Socket Programming in C/C++
DSA Sheet by Love Babbar
GET and POST requests using Python