I was wondering how can I list the user tables name with its primary key name as the second column?
I’m doing half the job but I doesn’t know what more to do.
select table_name from user_tables ORDER BY (table_name) ASC
Does anyone knows how?
Thank you
This simple query gives you a list of tables along with the PK constraint name (but not the column name):
If you want the column name, remember that a PK can have multiple columns! We need to create a utility type first because of the collect() aggregate function:
If you don’t like the formatting of the nested tab, you can write a utility function which will take an NT as input and provide concatenated comma-delimited string as output. Just don’t have the time to do it myself 😉