Re: references trace

  • From: jo <jose.soares@xxxxxxxxxxxxxx>
  • To: ORACLE-L <oracle-l@xxxxxxxxxxxxx>
  • Date: Fri, 04 Mar 2011 12:40:00 +0100

Your suggest was very useful,
thank you,
v

Bobak, Mark wrote:
You should take a look at DBA_CONSTRAINTS and DBA_CONS_COLUMNS.

Look for constraints with CONSTRAINT_TYPE='R'.

-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of jose soares
Sent: Thursday, March 03, 2011 10:57 AM
To: ORACLE-L
Subject: references trace
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






--
//www.freelists.org/webpage/oracle-l




--
//www.freelists.org/webpage/oracle-l




--
Jose Soares
Sferacarta Net Via Bazzanese 69
40033 Casalecchio di Reno
Bologna - Italy
Ph  +39051591054
fax +390516131537
web:www.sferacarta.com

Le informazioni contenute nella presente mail ed in ogni eventuale file allegato sono 
riservate e, comunque, destinate esclusivamente alla persona o ente sopraindicati, ai sensi 
del decreto legislativo 30 giugno 2003, n. 196. La diffusione, distribuzione e/o copiatura 
della mail trasmessa, da parte di qualsiasi soggetto diverso dal destinatario, sono 
vietate. La correttezza, l’integrità e la sicurezza della presente mail non 
possono essere garantite. Se avete ricevuto questa mail per errore, Vi preghiamo di 
contattarci immediatamente e di eliminarla. Grazie.

This communication is intended only for use by the addressee, pursuant to 
legislative decree 30 June 2003, n. 196. It may contain confidential or 
privileged information. You should not copy or use it to disclose its contents 
to any other person. Transmission cannot be guaranteed to be error-free, 
complete and secure. If you are not the intended recipient and receive this 
communication unintentionally, please inform us immediately and then delete 
this message from your system. Thank you.

--
//www.freelists.org/webpage/oracle-l


Other related posts: