Hi
I'm new in Informix. I have a big problem.
I have table "person" with a Primary key "pk_idPers" on a field "idPers":
------------
| idPers |
------------
| name |
------------
| pname |
------------
I want all tables(and coresponding fields for foreign key) that have foreign keys on idPers?
Example: Let's say that I have 30 tables that have foreign keys to table "person". I have in table "person" a record with idPers=1.
I want to get all tables from those 30 that have in field (that is in foreign key) the value 1.
My job is when I delete a record from a table to get all tables that have foreign keys to Primary key of my table.
All I achived is to get all tables that have foreign keys but I can't get the fields on FK. If I can get the fields in a stored procedure I want execute at runtime a statement that will retrive exactly the tables that have the value 1 for field that is in FK.
select SYSTABLES.tabname, con2.constrname from SYSREFERENCES,
sysconstraints con1, sysconstraints con2, SYSTABLES where
con1.constrname='pk_idPers' and SYSREFERENCES.primary=con1.constrid and
SYSREFERENCES.constrid=con2.constrid and con2.tabid=SYSTABLES.tabid;
I hope you understand, and somebody can help me. Thanks in advance...
