I've been researching for how to describe TABLES and VIEWS without using 'DESCRIBE table/view;' clause. I found that it could be solved using something like:
SELECT column_name, data_type, data_length, data_precision, data_scale, nullable
FROM all_tab_columns
WHERE table_name = 'TABLE'
Which is perfectly programmable in a computer language like PHP, but I didn't found a workaround for 'DESCRIBE package_name' clause.
I have the following idea (yet in SQL*PLUS with a spool):
DECLARE
x VARCHAR2(50);
CURSOR cursorPaquetes IS
SELECT DISTINCT OBJECT_NAME
FROM ALL_OBJECTS
WHERE OBJECT_TYPE = 'PACKAGE' AND OWNER = 'SATURN';
BEGIN
FOR item IN cursorPaquetes LOOP
x := 'DESCRIBE '||item.OBJECT_NAME||';';
EXECUTE IMMEDIATE x;
END LOOP;
END;
But it didn't work :(. Throws the following error:
ORA-00900: sentencia SQL no válida ORA-06512: en línea 12
And when modify the 'x' variable like this:
x := 'BEGIN DESCRIBE '||item.OBJECT_NAME||'; END;';
I get the following error:
ERROR en línea 1: ORA-06550: línea 1, columna 16: PLS-00103: Encountered the symbol "BVGKFDCS" when expecting one of the following: := . ( @ % ; The symbol ":=" was substituted for "BVGKFDCS" to continue. ORA-06512: en línea 12
Where "BVGKFDCS" is the name of one of the packages of my schema.
Thanks in advance.
P.D. I want to get something like that (but for each package):
DESCRIBE BVGKFDCS;
PROCEDURE P_GETPROFESSORS
Nombre de Argumento Tipo E/S ¿Por Defecto?
------------------------------ ----------------------- ------ --------
P_CAMP_IN VARCHAR2 IN
P_COLL_IN VARCHAR2 IN
P_DEPT_IN VARCHAR2 IN
P_TERM_IN VARCHAR2 IN
PROCEDURE P_GETTERMSBYPROF
Nombre de Argumento Tipo E/S ¿Por Defecto?
------------------------------ ----------------------- ------ --------
NAME_ARRAY TABLE OF VARCHAR2(32000) IN
VALUE_ARRAY TABLE OF VARCHAR2(32000) IN
PROCEDURE P_INIT
Nombre de Argumento Tipo E/S ¿Por Defecto?
------------------------------ ----------------------- ------ --------
PIDM VARCHAR2 IN
PROCEDURE P_OBTENER_VALOR
Nombre de Argumento Tipo E/S ¿Por Defecto?
------------------------------ ----------------------- ------ --------
Note that this output is different from:
select * from user_source