Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • In Addition to previous note, following grants needed on PERFSTAT user. Oracle
  • How do I get Oracle to automatically start when my server boots up? Oracle
  • This is im telling Kishore Oracle
  • dbms_job.submit example Oracle
  • 556976.1 Oracle Clusterware: Components installed Oracle
  • Load testing on Oracle 19C RAC with HammerDB Oracle
  • RAC 11g with vmware Oracle
  • How to Modify the statistics collection by MMON for AWR repository Oracle
  • Import and export statements Oracle
  • Restoring a user’s original password 1051962.101 Oracle
  • remove archfiles only when it is applied to DR rm_archfiles.sh Linux/Unix
  • export import with parameter file. Oracle
  • To find all disk io ( EMC as well as local) Linux/Unix
  • Renaming Global Name GLOBAL_NAME Oracle
  • Oracle Data Direct to TAPE Oracle

find_pk.sql /* Find Primary Key */

Posted on 02-Aug-2005 By Admin No Comments on find_pk.sql /* Find Primary Key */

set pagesize 300

set linesize 205

set head on

set echo off

spool tblwopk

accept usrid prompt ‘Enter User Name : ‘

accept table_name prompt ‘Enter Table Name : ‘

column PrimaryKey format a80 heading ‘Follwoing Are Primary Keys’

select substr(a.column_name, 1, 20) || ‘ Position : ‘ || to_char(a.position) PrimaryKey

from dba_cons_columns a, dba_constraints b

where b.table_name = upper(‘&TABLE_NAME’)

and b.owner = upper(‘&usrid’)

and a.constraint_name = b.constraint_name

and b.constraint_type = ‘P’

order by a.position;

Oracle, SQL scripts

Post navigation

Previous Post: fkwoindex.sql /* Find FK without Index */
Next Post: tblwopk.sql /* Find Tables Without PK */

Related Posts

  • crtgr.sql /* For creating trigger from data dictionary */ Oracle
  • Test Case for Inserting Multiple (2.3 Million rows in 26 Seconds) Oracle
  • sesswait.sql Oracle
  • findinfo.sql (SQL for getting CPU and Active session info) Oracle
  • create user with unlimited quota Oracle
  • Clean up Oracle

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Django (0)
  • GIT (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (397)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (150)
  • SQL scripts (345)
  • SQL Server (6)
  • Uncategorized (3)
  • Videos (0)

Recent Posts

  • Hello08-Apr-2026
  • Hello07-Apr-2026
  • Test107-Apr-2026
  • track_autoupgrade_copy_progress.sql01-Apr-2026
  • refre.sql for multitenant01-Apr-2026
  • prepfiles.sh for step by step generating pending statistics files10-Mar-2026
  • tracksqltime.sql05-Mar-2026
  • Complete Git Tutorial for Beginners25-Dec-2025
  • Postgres DB user and OS user.25-Dec-2025
  • Trace a SQL session from another session using ORADEBUG30-Sep-2025

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • ORA-01220 Oracle
  • V$transaction notes for finding XID composition. Oracle
  • Korn Shell Arithmatic Linux/Unix
  • Directory wise folder wise space usage Linux/Unix
  • PLSQL Table Syntax 2 Oracle
  • adding new line after specific pattern using sed Linux/Unix
  • Building Our Own Namespaces with “Create Context” Oracle
  • Hello Uncategorized

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme