Re: any sql statement to list child tables?

From: Peter Schneider <peter.schneider_at_okay.net>
Date: 1998/09/14
Message-ID: <6tk4m3$evv$4_at_trader.ipf.net>#1/1


Thenardier_at_POBoxes.com wrote:

>is there any sql statement which can list all the child tables and
>their keys and foriegn keys? ... cos i'm tired of consulting the
>3-inch technical references anymore! :P

Hi,

try this query:

SELECT uc.table name        master table,
       uc.constraint name   master key,
       uc.constraint type   master key type,
       uc2.table name       detail table,
       uc2.constraint name  foreign key
  FROM user constraints uc2,
       user constraints uc
 WHERE uc.table name = UPPER('&Master table')
   AND uc.constraint type IN ('P', 'U')
   AND uc.constraint name = uc2.r constraint name    AND uc2.constraint type = 'R'

HTH,
Peter

-- 
Peter Schneider
peter.schneider_at_okay.net
Received on Mon Sep 14 1998 - 00:00:00 CEST

Original text of this message