RE: how to find out the Primary key in SQL plus?

RE: how to find out the Primary key in SQL plus?

 

  

Hey Pitchai Siva,
DESC <table_name> will not show the primary key. Do you have access
to the "user_constraints" table?





Please take a few minutes to provide feedback on the quality of service you received from our staff. The Department of Education values your feedback as a customer. Commissioner of Education Dr. Eric J. Smith is committed to continuously assessing and improving the level and quality of services provided to you.Simply use the link below. Thank you in advance for completing the survey.


http://data.fldoe.org/cs/default.cfm?staff=Ed.[Email address protected]




-----Original Message-----
From: Pitchai Siva (GE Infra Energy Non-GE)
[mailto:oracledba-ezmlmshield-x5378658.[Email address protected]
Sent: Tuesday, March 04, 2008 8:52 AM
To: LazyDBA Discussion
Subject: 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





---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html

Oracle LazyDBA home page