Re: Stupid newbie question about foreign keys

From: <scott_j_felten_at_navtrans.navy.mil>
Date: 1998/03/06
Message-ID: <6dpngf$gjd$1_at_nnrp1.dejanews.com>#1/1


Hey Chick Green,

Try the following...when it says: Enter value for 1: You will need to enter the table name. This is a really cool script that I put together to identify some of the more usefull information that newbies have a hard time getting to.

Good luck...

scott

*

    Title: cons.sql
    Author: Scott Felten
    Description: Displays constraints on a table     Created: Fri Sep 5 14:27:54 EST 1997 */
set verify off
set long 45
set lines 190
set pages 24
set wrap on
col constraint_name for a25
col r_constraint_name for a25
col column_name for a25
col position head 'POS' for 99
col status for a8
col owner for a10
col r_owner for a15
break on constraint_name

select a.constraint_name,a.column_name,a.position,a.owner,
       b.status,b.constraint_type,b.search_condition,b.r_owner,
       b.r_constraint_name

 from sys.dba_cons_columns a, sys.dba_constraints b
 where b.owner = a.owner
   and a.table_name = upper('&1')
   and b.table_name = a.table_name
   and b.constraint_name = a.constraint_name;

In article <34ff40bc.87926561_at_news.gtdev.com>,   chick*nospam*green_at_gtdev.com wrote:
>
> I'm really new to this, but what I need is a script which will list
> all of the foreign keys for a table, and what table and column they
> come from.
>
> Can anyone help me with this?
>
> Thanks, Chick Green
>
> chickgreen_at_gtdev.com
>

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Fri Mar 06 1998 - 00:00:00 CET

Original text of this message