Select Table Relationship Tree

Scripts Diversos para o Oracle SQL*Plus. (Relacionado a ferramenta Oracle SQL*Plus, para questões de SQL, usar o forum SQL)
Post Reply
Guilly
Rank: Estagiário Sênior
Rank: Estagiário Sênior
Posts: 8
Joined: Wed, 17 Aug 2011 2:31 pm
Location: passo fundo - rs

Hello everyone,
I need to make a select that brings all the table relationships, or table1 -> table2 -> table3 ... etc. could only be the name of the tables, or if It is not possible just bring the fk and pk of the same, can anyone help me ??
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

Has this topic, which does not show in tree, but shows the parents and children of a table: http://en.glufke.net/oracle/viewtopic.php?t=883
Guilly
Rank: Estagiário Sênior
Rank: Estagiário Sênior
Posts: 8
Joined: Wed, 17 Aug 2011 2:31 pm
Location: passo fundo - rs

Thank you very much!!!!
But and if I wanted to clear these tables, without interfering with the connection between them. Could you use a "DELETE CASCADE" or do you have any other way that is not time consuming?
gfkauer
Rank: DBA Sênior
Rank: DBA Sênior
Posts: 389
Joined: Tue, 27 Jul 2010 1:34 pm
Location: Sapiranga - RS
Contact:
Quem falou que programar era fácil??

Quanto mais dificil for a implementação mais valorizado seu trabalho será!

Acessem: www.gfkauer.com.br

If your goal is only to erase a table, without daughters tables, a

Select all

Delete from tabela 
should meet ...

and considering the same scenario if you have the proper permissions a

Select all

truncate table tabela
] It would also work.
Guilly
Rank: Estagiário Sênior
Rank: Estagiário Sênior
Posts: 8
Joined: Wed, 17 Aug 2011 2:31 pm
Location: passo fundo - rs

I have to delete their data, but I can not delete their structure and their links ...
I also have to take into consideration that I will have to do this in more than 2000 tables and after I have to export them. I thought about truncate and delete, but how many are and I have these two restrictions, I believe it will be more difficult. The only way I found so far is to make DELETE Cascade. Of course I'm still very unexpected with BD.
If you can help me ...
ishii
Rank: Analista Júnior
Rank: Analista Júnior
Posts: 82
Joined: Tue, 28 Dec 2010 7:41 pm
Location: São Paulo - SP

Hello,

For registration: Given is given, structure is structure ... Deleting the data will not affect the structure of the table and not your relationships, the maximum that can occur is precisely to be "slow "Because of relationships and / or triggers (the damn triggers ...)

DELETE Cascade will erase the data in cascade, that is, the grandchildren first, then the daughters and only then The mothers tables ...

If you have to do this manually, it is a bit annoying, time-consuming (because of the relationships) and the delete command will take even. If it is only to export the tables, I suggest using the EXP (Rows = N) or EXPDP (content = metadata_only) as only the structures without the data ...
will be created. Having a test environment (or zero base as a taste of calling) could also:

1. Disabled all fks and PKs (in that order)
2.Trun all tables
3.Havil PKs and FKs (in that order also)
[] S ISHII
: -The
"Data does not bring happiness! "
Guilly
Rank: Estagiário Sênior
Rank: Estagiário Sênior
Posts: 8
Joined: Wed, 17 Aug 2011 2:31 pm
Location: passo fundo - rs

Thanks for the explanations !!!

As I said earlier, I do not know much of the bank and gave me this task to do ... I'm picking up a lot, but with the help of you I could do a lot of things.

Thank you very much and I hope to contribute my experiences.
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests