Remove structure from all Oracle SQL tables

1

With the following SELECT I see all the tables of a user:

SELECT table_name FROM all_tables where owner='usuario1'

Result:

TABLE_NAME
----------
USUARIOS
PRODUCTOS
CLIENTES
...(+300 tablas)

And with the statement describe I see the structure of a table:

describe productos;

Result:

PRODUCTOS
Nombre               Nulo     Tipo           
-------------------- -------- -------------- 
id_productos         NOT NULL  NUMBER(5)
nombre_producto                VARCHAR2(255)
...

How could you join these two functionalities?

I need to take out the structure of all the tables that are almost 400 tables.

    
asked by nachfren 21.11.2017 в 14:18
source

1 answer

1

For this you can use dmbs_metadata.get_ddl :

select dbms_metadata.get_ddl('TABLE', table_name, owner)
from all_tables
where owner = 'usuario1'
    
answered by 21.11.2017 / 14:27
source