views:

67

answers:

1

I'm doing an heterogeneous replication app in Django and need to determine the primary key fields of the tables that are going to get sync'ed.

+5  A: 
SELECT  l.column_name, l.position
FROM    all_constraints n
JOIN    all_cons_columns l
ON      l.owner = n.owner
        AND l.table_name = n.table_name
        AND l.constraint_name = n.constraint_name
WHERE   n.constraint_type = 'P'
        AND n.table_name = 'MYTABLE'
        AND n.owner = 'SCOTT'
Quassnoi