Are you saying that SQL is slow? Why don't you trying running it directly from the worksheet, or SQLcl, or even in SQL*Plus (if you have it) to see if you get a similar slow response.
Query runs fine in SQL*Plus, I included the query in case it means anything to the folks who wrote the "drag and drop" code for query builder.
*Updated... the original posted query runs fine. I found the following query to take over 1 minute in SQL Plus...
select * from ( select pkc.OWNER as PK_SCHEMA_NAME, pkc.TABLE_NAME as PK_TABLE_NAME, pkc.COLUMN_NAME as PK_FIELD_NAME,
fkc.OWNER as FK_SCHEMA_NAME, fkc.TABLE_NAME as FK_TABLE_NAME, fkc.COLUMN_NAME as FK_FIELD_NAME,
pkc.POSITION as ORDINAL from ALL_CONSTRAINTS fk, ALL_CONS_COLUMNS fkc,
ALL_CONS_COLUMNS pkc where (fk.CONSTRAINT_TYPE in ('R'))and (fk.OWNER = fkc.OWNER)and(fk.CONSTRAINT_NAME = fkc.CONSTRAINT_NAME)and
(fk.R_OWNER = pkc.OWNER)and(fk.R_CONSTRAINT_NAME = pkc.CONSTRAINT_NAME)and (fkc.POSITION = pkc.POSITION) ) r
where((PK_TABLE_NAME like 'TEST_TABLE')) or ((FK_TABLE_NAME like 'TEST_TABLE'))
If the dictionary query is slow, then normally that would be something to discuss with your DBA. The difference between the two SQL statements occurs in the final where clause, with additional predicates applied on the PK and FK SCHEMA_NAME columns. In my environment using local 11.2 XE and remote 12.2 EE instances I don't see much of a difference, but perhaps your 12.0 has many users.