Query to find foreign keys in an Oracle database

The following query will return all of the columns for a table and will include an indicator if the column is a foreign key:

 

select utc.*,
case when exists(
select 1 
from all_cons_columns ucc
join all_constraints uc on ucc.constraint_name = uc.constraint_name
where uc.constraint_type = 'R'
and uc.table_name = utc.table_name
and ucc.column_name = utc.column_name)
then 1
else 0
end IsForeign
from all_tab_columns utc where utc.table_name = 'YOURTABLE' and utc.owner = 'THEOWNER'