Identify Fields Primary Key

Dúvidas, dicas e truques de PL/SQL. Aqui também vão assuntos relacionados a pacotes, triggers, funções, Java-Stored Procedures, etc
Post Reply
Pablo
Rank: DBA Júnior
Rank: DBA Júnior
Posts: 190
Joined: Fri, 27 Oct 2006 11:12 am
Location: 88350000
Pablo

Good morning guys ... I need to identify which columns are primary key via select ....

thanks for now
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

Select all

 
select * from all_constraints where table_name = 'nomeTabela' and constraint_type = 'P' 
Pablo
Rank: DBA Júnior
Rank: DBA Júnior
Posts: 190
Joined: Fri, 27 Oct 2006 11:12 am
Location: 88350000
Pablo

Ow victor, thank you for force, but I wanted to know which column name is primary key ... type, cod_client .... but would have to be via select ...
thanks for the force.
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

Select all

 
select column_name  
from all_cons_columns acc, 
     all_constraints ac 
where acc.table_name = ac.table_name 
     and ac.table_name = 'SUA_TABELA' 
     and ac.constraint_type = 'P' 
User avatar
dr_gori
Moderador
Moderador
Posts: 5027
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

It has this query that I made a time ago: http://en.glufke.net/oracle/viewtopic.php?t=883
She shows the fields of constraints side by side :-)
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest