SQL Developer, bunu yapan bir raporla birlikte gelir.
Sadece giriş şeması için yapar, ancak 'APEX ...' ve 'SYS' gibi şemaları atlamak isteyebilirsiniz, ancak veritabanındaki her FK'yi almasını sağlamak için hızlı bir çözümdür.
Ayrıca, geri dönüşüm kutusundaki tablolar gibi şeyleri de atlar.
Orijinal rapor Raporlar panelinde, veri sözlüğü raporlarında bulunur.
İşte TÜM FK'leri almak için değiştirilmiş sorgu.
SELECT
c.owner "Owner",
c.table_name "Table_Name",
c.constraint_name "Constraint_Name",
c.delete_rule "Delete_Rule",
d.columns,
c.r_owner "Owner of Related Table",
(
SELECT
r.table_name
FROM
sys.all_constraints r
WHERE
c.r_owner = r.owner
AND
c.r_constraint_name = r.constraint_name
) "Related Table",
c.r_constraint_name "Related Constraint"
FROM
sys.all_constraints c,
(
SELECT
a.owner,
a.table_name,
a.constraint_name,
MAX(
DECODE(position,1,substr(column_name,1,30),NULL)
)
|| MAX(
DECODE(position,2,','
|| substr(column_name,1,30),NULL)
)
|| MAX(
DECODE(position,3,','
|| substr(column_name,1,30),NULL)
)
|| MAX(
DECODE(position,4,','
|| substr(column_name,1,30),NULL)
)
|| MAX(
DECODE(position,5,','
|| substr(column_name,1,30),NULL)
)
|| MAX(
DECODE(position,6,','
|| substr(column_name,1,30),NULL)
)
|| MAX(
DECODE(position,7,','
|| substr(column_name,1,30),NULL)
)
|| MAX(
DECODE(position,8,','
|| substr(column_name,1,30),NULL)
)
|| MAX(
DECODE(position,9,','
|| substr(column_name,1,30),NULL)
)
|| MAX(
DECODE(position,10,','
|| substr(column_name,1,30),NULL)
)
|| MAX(
DECODE(position,11,','
|| substr(column_name,1,30),NULL)
)
|| MAX(
DECODE(position,12,','
|| substr(column_name,1,30),NULL)
)
|| MAX(
DECODE(position,13,','
|| substr(column_name,1,30),NULL)
)
|| MAX(
DECODE(position,14,','
|| substr(column_name,1,30),NULL)
)
|| MAX(
DECODE(position,15,','
|| substr(column_name,1,30),NULL)
)
|| MAX(
DECODE(position,16,','
|| substr(column_name,1,30),NULL)
) columns
FROM
sys.all_constraints a,
sys.all_cons_columns b
WHERE
a.constraint_name = b.constraint_name
AND
a.owner = b.owner
AND
a.constraint_type = 'R'
AND
substr(a.table_name,1,4) != 'BIN$'
AND
substr(a.table_name,1,3) != 'DR$'
AND (
:table_name IS NULL
OR
instr(upper(a.table_name),upper(:table_name) ) > 0
) GROUP BY
a.owner,
a.table_name,
a.constraint_name
) d
WHERE
c.owner = d.owner
AND
c.table_name = d.table_name
AND
c.constraint_name = d.constraint_name
ORDER BY
c.owner,
c.table_name,
c.constraint_name
İşte rapor böyle görünüyor.