--#ORACLE
select
    table_name,
    column_name
from
    user_cons_columns
where
    constraint_name = '<CONSTRAINT_NAME>'
;
--#INTERBASE
select
s.rdb$index_name as CONSTRAINT_NAME
,trim(i.rdb$relation_name) as TABLE_NAME
,trim(s.rdb$field_name) as COLUMN_NAME
,i.rdb$foreign_key as R_CONSTRAINT_NAME
,trim(ir.rdb$relation_name) as R_TABLE_NAME
,trim(sr.rdb$field_name) as R_COLUMN_NAME
,trim(i.rdb$relation_name)||'.'||trim(s.rdb$field_name) as TBL_COL
from rdb$indices i
join rdb$index_segments s on s.rdb$index_name = i.rdb$index_name
join rdb$index_segments sr on sr.rdb$index_name = i.rdb$foreign_key
join rdb$indices ir on ir.rdb$index_name = sr.rdb$index_name
where
--trim(i.rdb$index_name) = 'FK_PAYDETAILLINE_PG' -- для Foreign key
trim(i.rdb$foreign_key) = 'PK_BUDGETLINE' -- для Primary key
;
Комментариев нет:
Отправить комментарий