references trace

From: jose soares <jose.soares_at_sferacarta.com>
Date: Thu, 03 Mar 2011 16:57:05 +0100
Message-ID: <4D6FBA51.9070405_at_sferacarta.com>



Hi all,

I'm trying to trace all references to a table.

I have a table, like this one:

create table mytable(

    id int primary key,
    description varchar2(200)
    version int);

I would like to know which tables have a reference to mytable.

in PostgreSQL I can do that in this way:

SELECT c.relname, r.conname
  FROM pg_catalog.pg_constraint AS r, pg_catalog.pg_class AS c   WHERE r.contype = 'f'
  AND r.conrelid = c.oid
  AND conname like '%_mytable_fkey'
  ORDER BY 1

        relname         |                    conname
------------------------+------------------------------------------------
 abbattimento_ordinanza | abbattimento_ordinanza_id_mytable_fkey
 autorizzazione         | autorizzazione_id_mytable_fkey
 capo                   | capo_id_mytable_fkey
 capo_rubato            | capo_rubato_id_mytable_fkey
 controllo_capo         | controllo_capo_id_mytable_fkey
 figura_aziendale       | figura_aziendale_id_mytable_fkey
 gestione_doc_file      | gestione_doc_file_id_mytable_fkey
 marca_ristampata       | marca_ristampata_id_mytable_fkey
 movimento              | movimento_id_mytable_fkey
 passaporto             | passaporto_id_mytable_fkey
 pratica                | pratica_id_mytable_fkey
 prestazione            | prestazione_id_mytable_fkey
 produzione             | produzione_id_mytable_fkey
 ricetta                | ricetta_id_mytable_fkey
 scadenza_malattia      | scadenza_malattia_id_mytable_fkey
 scadenziario           | scadenziario_id_mytable_fkey
 scheda                 | scheda_id_mytable_fkey
 scheda_totali          | scheda_totali_id_mytable_fkey
 sopralluogo            | sopralluogo_id_mytable_fkey
 trasporto              | trasporto_id_mytable_fkey
 versamento             | versamento_id_mytable_fkey
(21 rows)

Is there a way to do it on Oracle?

thanks for any help,

j

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Mar 03 2011 - 09:57:05 CST

Original text of this message