how to find out the Primary key in SQL plus?

how to find out the Primary key in SQL plus?

 

  

Hi DBA's,



In SQL Plus, how to find out the primary key columns if I put the DESC
<table_name>



Every one knows that the primary key constraint columns shows as the
"NOT NULL"



But, suppose if the table has primary key as well NOT NULL constraint
also in multiple columns how can we find out the primary key constraint
columns?

If you are not using any GUI tools (like TOAD, PL/SQL developer)



If I try to fetch the details from all_constraints table using the below
query, I don't have privileges to access the system table



Select * from all_constraints

where table_name =Table_name'

and owner = 'schema_name'

and constraint_type = 'P';



How can we find out the Primary key constraint using DESC <table_name>
command in SQL_PLUS?



Regards,

Siva.P

Bangalore




Oracle LazyDBA home page