RE: Truncating Table related to other table

RE: Truncating Table related to other table

 

  

Here, modified from a script by Todd Pepling.

/*
*------------------------------------------------------------
* Children
*----------------------------------------------------------*/
BREAK ON CON ON COWN SKIP 1

SELECT
R_CONSTRAINT_NAME CON
,TABLE_NAME CTAB
,CONSTRAINT_NAME CCON
FROM
USER_CONSTRAINTS
WHERE
R_CONSTRAINT_NAME IN ( SELECT
CONSTRAINT_NAME
FROM
USER_CONSTRAINTS
WHERE
TABLE_NAME = '&&THE_TABLE'
)
ORDER BY TABLE_NAME;


/*
*------------------------------------------------------------
* Parents
*----------------------------------------------------------*/
SELECT
C.CONSTRAINT_NAME CON
,P.TABLE_NAME PTAB
,P.CONSTRAINT_NAME PCON
FROM
USER_CONSTRAINTS P
,USER_CONSTRAINTS C
WHERE
P.CONSTRAINT_NAME IN (
SELECT
R_CONSTRAINT_NAME
FROM
USER_CONSTRAINTS
WHERE
TABLE_NAME = '&&THE_TABLE'
AND
CONSTRAINT_TYPE = 'R'
)
AND
C.R_CONSTRAINT_NAME = P.CONSTRAINT_NAME
AND
C.CONSTRAINT_TYPE = 'R'
AND
C.TABLE_NAME = '&&THE_TABLE'
ORDER BY P.TABLE_NAME;


-----Original Message-----
From: RABaltazar
[mailto:oracledba-ezmlmshield-x89961534.[Email address protected]
Sent: Wednesday, August 31, 2005 5:56 AM
To: LazyDBA Discussion
Subject: RE: Truncating Table related to other table


Hi to all, im new to Oracle, im trying to truncate a table, but the
database wouldn't allow since the table has other index related to other
table. I think ineed to delete those rows on the said table(s) fisrt but
HOW CAN I KNOW WHICH TABLE(s). How to find out?

Thanks,


__________________________________________________
This communication is intended solely for the use of the addressee and
authorized recipients. It may contain confidential or legally
privileged information and is subject to the conditions in
http://www.smart.com.ph/disclaimer.


--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html



Oracle LazyDBA home page