Is there a way to extract the PK value for a record without using the field name?

asked 2020-09-09 18:59:31 -0600

Tron gravatar image

I have a SDC RPC pipeline that is processing records from multiple tables. I am trying to extract the value of the PK along with the table name to insert into another table. Trying to keep this generic and don’t want to specify the field name to pull the value since there are multiple tables involved. I was planning on using JDBC lookup to pull the PK column name using the table name and then use one the record functions to extract the value but this may be an overkill.

Inputs appreciated!

edit retag flag offensive close merge delete


what is the origin for your tables? is it an oracle db or any other db?

satender gravatar imagesatender ( 2020-09-10 08:23:56 -0600 )edit

Origin is Oracle DB

Tron gravatar imageTron ( 2020-09-10 09:59:21 -0600 )edit

I think @Tron you can all_constraints cons and all_cons_columns oracle tables to get the primary key (single or composite) column name based on the table name.

satender gravatar imagesatender ( 2020-09-10 13:16:47 -0600 )edit

@satender thanks for your input ! Yes this is what I am doing right now and it works but I was looking for a better way to do this to avoid firing a query for every record.

Tron gravatar imageTron ( 2020-09-10 20:58:41 -0600 )edit

Looks like there is a caching option that I am going to explore

Tron gravatar imageTron ( 2020-09-11 14:13:51 -0600 )edit