user3470294
user3470294

Reputation: 190

Oracle DDL Python Scripting

I have a Oracle database, that contains metadata of Database Tables. Example.

Table- Entity Entity Property
Emp Table
Position Table

Table Attributes
Attributes Table_Name
Emp_Name Emp
Emp_No Emp
Emp_Add Emp
Postion_id Position
Position_Name Position

I want a python script which you create DDL for the above tables. For example, the output should contain like this tables
create table 'emp','details'
create table 'position','details'

For Attributes, I would like the script to output like this
put 'emp','1','details:Emp_Name','1'
put 'emp','1','details:Emp_No','1'

Please, advise me.

Upvotes: 0

Views: 1072

Answers (1)

Pavel Zimogorov
Pavel Zimogorov

Reputation: 1442

Maybe you should pay attention on DBMS_METADATA package.

For example:

select DBMS_METADATA.GET_DDL('TABLE', 'EMP') from dual;

link on documentation.
It is available for all Oracle users.

Upvotes: 1

Related Questions