Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> How to open a cursor for the results of describe?
Hi All,
I need to know the column structure (name, datatype and length) of any table or view I can select from. This should include all tables and views that come availbale through a sysnonym, possible over a database link. In all_objects I can find all synonyms that I can access. In all_tab_columns, however, these synonyms are not listed. If I execute the following statement, these cases will show:
SELECT object_name
FROM all_objects
WHERE object_type = 'SYNONYM'
AND owner != 'PUBLIC'
AND object_name NOT IN
( SELECT table_name FROM all_tab_columns );
DESCRIBE <synonym>, using Toad, the column structure shows up nicely. Unfortunately, DESCRIBE is not available in PL/SQL. Is there a way to treive this information in PL/SQL, preferrably in a cursor? That is, some equivalent of:
OPEN <My_Cursor>
FOR
SELECT COLUMN_NAME
, DATA_TYPE
, CHAR_LENGTH
FROM ALL_TAB_COLUMNS
WHERE TABLE_NAME = <My_TableName>;
Received on Mon Mar 14 2005 - 04:38:20 CST