Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Histogram information Oracle
  • find_du.ksh to find # of files, their sizes in current folder and its subdolder Linux/Unix
  • Good notes on Oracle Events Oracle
  • fdisk -l explaination about Primary-Logical-Extended Partitions Linux/Unix
  • When to rebuld B-tree index Oracle
  • sql_doing_fts.sql Oracle
  • Query to Generate aggregate on every 30 mins. Oracle
  • temp_use.sql diplays usage of temp ts Oracle
  • Restoring a user’s original password 1051962.101 Oracle
  • DBMS_STATS Metalinks Notes Oracle
  • V$transaction notes for finding XID composition. Oracle
  • Building Our Own Namespaces with “Create Context” Oracle
  • Configure ssh authentications for RAC Oracle
  • Explain Plan Output 2 Oracle
  • sbind.sql Find Bind variable from sql_id sqlid 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

  • Best approach for Oracle database patching sequence to latest/required patchset along with CPU/PSU/any-other-one-off patch ID 865255.1 Oracle
  • SQL_PROFILE – I explaination Oracle
  • sql_doing_fts.sql Oracle
  • UTL_FILE test program Oracle
  • Ports used by Oracle Software Oracle
  • how to find OS block size Oracle

Leave a Reply Cancel reply

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

Categories

  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • Oracle (392)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (341)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • load SPM baseline from cursor cache05-Jun-2025
  • Drop all SPM baselines for SQL handle05-Jun-2025
  • Load SPM baseline from AWR05-Jun-2025
  • Drop specific SQL plan baseline – spm05-Jun-2025
  • findinfo.sql (SQL for getting CPU and Active session info)27-May-2025
  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • move_arch_files.ksh Linux/Unix
  • Good notes for shared pool Oracle
  • scripts to take listener.log backup Linux/Unix
  • How do I get Oracle to automatically start when my server boots up? Oracle
  • Exadata Basics Oracle
  • Test Case for Inserting Multiple (2.3 Million rows in 26 Seconds) Oracle
  • This is from Temi Oracle
  • TRUNCATE Privs Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme