SQL & IB System Tables

Hi

What I need to display is the index name and also the
domain name for each primary key in an Interbase table.

Like the folowing eaxmple that works on the sample IB
table Employees that ships with IB, these examples run
are run in wisql.

eg:
Select * from RDB$RELATION_CONSTRAINTS

Select RDB$INDEX_NAME,
RDB$RELATION_NAME FROM RDB$INDICES
where RDB$RELATION_NAME = 'DEPARTMENT'
AND RDB$UNIQUE_FLAG =1

Select * from RDB$RELATION_CONSTRAINTS (view the domain names)

RDB$CONSTRAINT_NAME             RDB$CONSTRAINT_TYPE
RDB$RELATION_NAME               RDB$DEFERRABLE RDB$INITIALLY_DEFERRED
=============================== ===================
=============================== ============== ======================

INTEG_1                         NOT NULL
COUNTRY                         NO             NO
INTEG_2                         PRIMARY KEY
COUNTRY                         NO             NO
INTEG_3                         NOT NULL
COUNTRY                         NO             NO

Select RDB$INDEX_NAME, (get the primary indexs on department)
RDB$RELATION_NAME FROM RDB$INDICES
where RDB$RELATION_NAME = 'DEPARTMENT'
AND RDB$UNIQUE_FLAG =1

RDB$INDEX_NAME                  RDB$RELATION_NAME
=============================== ===============================

RDB$4                           DEPARTMENT
RDB$PRIMARY5                    DEPARTMENT

eg: the ouput to look like this

RDB$CONSTRAINT_NAME RDB$INDEX_NAME RDB$DEFERRABLE RDB$INITIALLY_DEFERRED

=================== ============== ============== ======================

INTEG_1             RDB$4          NO             NO
INTEG_2             RDB$PRIMARY5   NO             NO
INTEG_3             RDB$PRIMARY9   NO             NO