Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Oracle Schema

Is there any way to retrieve oracle schema in c#? These are what I need: Tables_Name, Table Columns_Name, Primary Keys, Unique Keys, Foreign Keys

like image 285
XlbrlX Avatar asked Dec 07 '25 02:12

XlbrlX


1 Answers

Table Names:

select * from user_tables

Table Column Names:

select * from user_tab_columns

Primary Keys, Unique Keys, Foreign Keys:

select * from user_constraints

More generally:

select * from dictionary

to see all the possible system views you can use.

If you want the actual DDL used to create the tables etc you can use dbms_metadata.get_ddl, which returns a CLOB.

For instance:

select dbms_metadata.get_ddl('TABLE','MY_TABLE') from dual;
like image 158
Ben Avatar answered Dec 08 '25 15:12

Ben



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!