Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> foreign key constraints

foreign key constraints

From: Guy Hammond <guy.hammond_at_avt.co.uk>
Date: Tue, 21 Aug 2001 07:57:06 -0700
Message-ID: <F001.0037230E.20010821064553@fatcity.com>

Let's say I had two tables:

CREATE TABLE t1 (

        col1 NUMBER PRIMARY KEY);

CREATE TABLE t2 (

        col2 REFERENCES t1(col1),
        col3 VARCHAR2(40));


Then I ran the query:

select a.table_name, b.table_name, b.column_name from user_constraints a, user_cons_columns b where a.r_constraint_name = b.constraint_name and a.constraint_type='R';

I will get back a result set containing

a.table_name = t2
b.table_name = t1
b.column_name = col1

But what query would I run to find "col2"?

Thanks,

g

--

Guy Hammond
AVT Technologies
12-16 Westland Place
London N1 7LP UK

Email: guy.hammond_at_avt.co.uk
Office: +44 (0) 207 454 1224
Mobile: +44 (0) 7966 164687

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Guy Hammond
  INET: guy.hammond_at_avt.co.uk

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists

--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Tue Aug 21 2001 - 09:57:06 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US