Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Difference between SYNC and AFFIRM Oracle
  • catting.sh Linux/Unix
  • DBMS_JOB all example Oracle
  • How To Limit The Access To The Database So That Only One User Per Schema Are Connected (One Concurrent User Per Schema) Oracle
  • oracle_env_10g_CADEV Linux/Unix
  • telnet listening Linux/Unix
  • Metalink Note: Note:250655.1 : ADDM Basics USING THE AUTOMATIC DATABASE DIAGNOSTIC MONITOR Oracle
  • replace alphabets using sed Linux/Unix
  • oracle tips… from http://www.bijoos.com/oracle/douknow.htm Oracle
  • Flowers Resize datafiles Oracle
  • Proc Compilation Oracle
  • db_status.sql Oracle
  • Reading parameter file and printing Linux/Unix
  • Histogram Overview Oracle
  • checking redhat linux version Linux/Unix

find_cons.sql

Posted on 02-Aug-2005 By Admin No Comments on find_cons.sql

set pagesize 300

set linesize 130

set head on

set echo off

accept tab prompt “Enter The Table Name -> ”

select b.constraint_name “Cons Name”, b.status,

decode(b.constraint_type, ‘P’, ‘PRIMARY’, ‘C’, ‘CHECK’, ‘U’, ‘UNIQUE’, ‘R’, ‘FOREIGN KEY’) “Cons Type”,

substr(a.column_name, 1, 20) “Column Name”,

decode(b.constraint_type, ‘C’, ‘ MUST NOT BE NULL’ , ‘ Position : ‘) ||

decode(b.constraint_type, ‘C’, null, to_char(a.position) ) ||

decode (b.constraint_type, ‘R’, ‘ REFERENCES ‘, NULL) ||

decode (b.constraint_type, ‘R’, c.xparent , NULL) “Cons Description”

from user_cons_columns a, user_constraints b,

(select parent.table_name xparent, child.table_name xchild, child.constraint_name xcons

from user_constraints parent, user_constraints child

where parent.constraint_name = child.r_constraint_name) c

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

and a.constraint_name = b.constraint_name

and a.constraint_name = c.xcons(+)

order by b.constraint_name, a.position;

set head off

select ‘AND THIS TABLE &tab IS PARENT TABLE OF FOLLOWING TABLES’ from dual;

set head on

select a.table_name parent, b.table_name child, b.constraint_name “Child Cons Name”, b.status

from user_constraints a, user_constraints b

where a.constraint_name = b.r_constraint_name

and a.table_name = upper(‘&tab’);

set head on

Oracle, SQL scripts

Post navigation

Previous Post: Explain Plan Output 2
Next Post: findobj.sql

Related Posts

  • How to specify 2 arch location to avoid any kind of DB hanging. Oracle
  • How to Decide upto what level you can decrement your datafile size. ( Shrink Datafile) Oracle
  • Generating XML from SQLPLUS Oracle
  • alter database backup controlfile to trace Oracle
  • Load testing on Oracle 19C RAC with HammerDB Oracle
  • How to find where datafile is created dbf_info.sql 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 (394)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (343)
  • SQL Server (6)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • 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
  • SQL Server Vs Oracle Architecture difference25-Jul-2025
  • SQL Server: How to see historical transactions25-Jul-2025
  • SQL Server: How to see current transactions or requests25-Jul-2025
  • T-SQL Vs PL/SQL Syntax25-Jul-2025
  • Check SQL Server edition25-Jul-2025
  • Checking SQL Server Version25-Jul-2025

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • lck.sql Oracle
  • fuser to check who is using diretory Linux/Unix
  • standard Monitoring – 1 Oracle
  • Vivek’s egrep commands to trace problem. (on linux x86-64) Linux/Unix
  • refre.sql Oracle
  • Validating ORACLE_SID againt oratab file. Linux/Unix
  • How does one overcome the Unix 2 Gig file limit? Linux/Unix
  • _B_TREE_BITMAP_PLANS issue during 8.1.7 to 9.2.0.8 upgrade Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme