Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Caching sequence in Memory Oracle
  • Oracle 11g Environment Setup Oracle
  • Alter procedure auditing Oracle
  • remove archfiles only when it is applied to DR rm_archfiles.sh Linux/Unix
  • Reclaim temp tablespace for oracle 8, 8i Oracle
  • move_arch_files.ksh Linux/Unix
  • Virtual Indexes in Oracle Oracle
  • More info about /proc folder and its relation with processes. Linux/Unix
  • load SPM baseline from cursor cache Oracle
  • nfs mount command Linux/Unix
  • Test Case for Inserting Multiple (2.3 Million rows in 26 Seconds) Oracle
  • Rownum with Order by Oracle
  • Multiple listeners Oracle
  • longtx.sql with the flag whether session is blocking any DML locks or not. Oracle
  • Jai Shree Ram 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

  • All Hints for Oracle Databases Oracle
  • V$CONTROLFILE_RECORD_SECTION reference notes. Oracle
  • How to connect to Oracle Database with Wallet with Python. Oracle
  • findx.sql /* Find Indexes on specified USER.TABLE_NAME */ Oracle
  • Benefits and Usage of RMAN with Standby Databases Oracle
  • How to analyze statspack or AWR report. 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
  • 339939.1 Running Cluster Verification Utility to Diagnose Install Problems Oracle
  • create trigger syntax Oracle
  • replace alphabets using sed Linux/Unix
  • How To Resolve Stranded DBA_2PC_PENDING Entries ID 401302.1 (Very Good prooven) Oracle
  • fkwoind.sql fkwoindex.sql Oracle
  • Oracle Standby Database Library Index from Metalink Oracle
  • longtx.sql with the flag whether session is blocking any DML locks or not. Oracle
  • Renaming the column name Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme