Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: ORA-02298: How do I find rows that do not join ?
You can use the exception table:
1) create the constraint with the disable clause:
alter table ... add constraint ... foreing key (...) references ... disable;
2) create an exception table using utlexcpt.sql in your rdbms/admin
directory
3) enabling the constraint:
alter table ... enable constraint ... exceptions into exceptions;
4) then the table exceptions contains the rowid of orphan rows.
--
Have a nice day
Michel
rockcogar <rock_cogarNOroSPAM_at_my-deja.com.invalid> a écrit dans le message :
2a9003b0.058ff07c_at_usw-ex0103-019.remarq.com...
> Hi,
>
> I just got a
>
> ORA-02298: cannot validate (schema.fk) - parent keys not found
>
> error when I try to create a foreign key.
>
> These orphaned records are common enough and usually easy to
> find and fix in DBs that come out of Access 97/Excel/whatever
> from questionable sources. What makes this one so difficult is
> that the table has nearly a million rows and the primary key of
> the parent table is made up out of 8 columns !
>
> QUESTION: Does anyone out there know a technique to find the
> orphans in foreign key creations where the keys are multi-column
> and the rowcount is very large ?
>
> Thanks,
> Rock.
>
>
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
> The fastest and easiest way to search and participate in Usenet - Free!
>
Received on Wed Feb 09 2000 - 03:04:20 CST