Database Administration (MOSC)

MOSC Banner

SQL Query issue

Oracle RAC DB Enterprise Edition - 19.20 version

I need to run the query to get table_owner, table_name, column_name, data_type, Primary_key(yes/no), Foreign_key(yes/no). I am joining DBA_TAB_COLUMNS + DBA_CONS_COLUMNS + DBA_CONSTRAINTS.

when I run the query:

SELECT COUNT(*) from DBA_TAB_COLUMNS where OWNER in('PCCPROD'); I get rows = 3,268 rows but

when I run the following query with 3 table join, I get 3,288 rows.

Reason is, it brings all the constraints, i.e. P, R, C, F, O, U, etc. ( it brings 20 extra rows)

Requirement is, I need to show only Primary Key(P) and Foreign Key® constraints for each column in a table.

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center