I am using PL SQL with an Oracle database
I am trying to make a primary key from two fields in a table.
The table is dhcs_contstat_hn2017_TEMP
The new primary key field is called "PrimaryKey". But it is not set as a primary key yet
The fields I am using to make the field are "record_id" and "main_sgmnt_id_no".
The primary key needs to be inserted on the line that matches the "record_id" and "main_sgmnt_id_no".
I have the psuedo code below, .
INSERT INTO dhcs_contstat_hn2017_TEMP c
(PrimaryKey)
SELECT concat(t.record_id, t.main_sgmnt_id_no)
FROM dhcs_contract_status_hn2017 t
WHERE c.main_sgmnt_id_no = t.main_sgmnt_id_no
;
How do I do this?
Thanks,
Scott