You can just parse the error text and query the dictionary, eg
SQL> create table parent ( p int primary key );
Table created.
SQL> create table child1 ( c int, p int references parent(p));
Table created.
SQL> create table child2 ( c int, p int references parent(p));
Table created.
SQL>
SQL> insert into parent values (1);
1 row created.
SQL> insert into child1 values (1,1);
1 row created.
SQL> insert into child2 values (1,1);
1 row created.
SQL>
SQL> insert into parent values (10);
1 row created.
SQL> insert into child1 values (1,10);
1 row created.
SQL>
SQL> delete from parent where p = 10;
delete from parent where p = 10
*
ERROR at line 1:
ORA-02292: integrity constraint (MCDONAC.SYS_C0031304) violated - child record found
SQL>
SQL> set serverout on
SQL> declare
2 err varchar2(1000);
3 cons_viol exception;
4 pragma exception_init(cons_viol,-2292);
5
6 own varchar2(200);
7 tab varchar2(200);
8 begin
9 delete from parent where p = 10;
10 exception
11 when cons_viol then
12 err := substr(sqlerrm,34);
13
14 select owner, table_name
15 into own,tab
16 from all_constraints
17 where owner = substr(err,1,instr(err,'.')-1)
18 and constraint_name = substr(err,instr(err,'.')+1,instr(err,')')-instr(err,'.')-1 );
19 raise_application_error(-20000,'You still have some records in '||own||'.'||tab);
20 end;
21 /
declare
*
ERROR at line 1:
ORA-20000: You still have some records in MCDONAC.CHILD1
ORA-06512: at line 19