You are html tracking Visitor

Wednesday, July 30, 2008

How to know the columns of given table and status of the table or object given

How to know the columns of given table and status of the table or object given:-
-------------------------------------------------------------------------------------------

I know the Object Name (Object can be anything like Package, Procedure, Function, Table, View or synonym name etc), If I want to check whether that object exist in the database or not. If exist then, is it active or what is the owner of object etc. All the details can be found from the following select statement.

SELECT * FROM ALL_OBJECTS WHERE OBJECT_NAME = 'your object name';

Example:-

SELECT * FROM ALL_OBJECTS WHERE OBJECT_NAME = 'EMP';

I know the table name and from backend I want to know the column name, data_type, date_length etc of the given table. For this, you can use the following Query.

SELECT column_name,data_type,data_length FROM dba_tab_columns
WHERE table_name = 'Your Table Name';

Example:-

SELECT column_name,data_type,data_length FROM dba_tab_columns
WHERE table_name = 'EMP';

No comments: