SQL query to find primary key
Can anyone suggest a query that would return all of the columns in the primary key of a table? Information on why I'm asking can be found below.
I'm currently using the following query, but it won't work right if there are unique indexes on the table besides the primary key.
"select column_name from all_ind_columns c, all_indexes i where c.index_owner = i.owner and c.index_name = i.index_name and i.table_owner = {me} and i.table_name = {table_name} and uniqueness = 'UNIQUE'"
The reason I'm interested in the primary key is I need to merge the contents of table A into a table B with the same structure, and before I can do this I need to delete any rows that will cause insertion to fail.