Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using CONNECT BY with DBA_CONSTRAINTS VIEW

641067Jun 6 2008 — edited Jun 6 2008
I am building a query using the Dba_Constraints view and CONNECT BY Operator.

I should fill some tables and I want to avoid FKs errors, but... I'll need to follow the right order to do that. So, I wrote a query but it's not working!. The first version stopped the recursion on the second level... I tried to fix it but I've only got an even worst result!

This is the 1st version:

SELECT SYS_CONNECT_BY_PATH(C.TABLE_name, ' >> ') "Path"
FROM dba_constraints c
WHERE owner = :anOwner
AND LEVEL > 1 CONNECT BY constraint_name = prior r_constraint_name
AND PRIOR owner = prior r_owner
ORDER BY LEVEL DESC,
TABLE_NAME ASC;

Can anyone help me with this query?

Thanks!

Martin
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2008
Added on Jun 6 2008
2 comments
4,664 views