You are on page 1of 1

SET SERVEROUTPUT ON

DECLARE
parentpk NUMBER;
BEGIN
insert into customer_activity_v2
select SOT_PK, PUBLIC_PERSON_ID, CUSTOMER_CPF, CREATED_BY_ID, CREATED_BY_NAME,
CUSTOMER_FULL_NAME, CUSTOMER_EMAIL, CUSTOMER_PHONE, PUBLIC_DEALER_ID,
HOTNESS_LEVEL, MODIFIED_DATETIME, OWNER_ID,
OWNER_NAME, SOURCE, CREDIT_APP_DECISION_JSON, NVL(null,
'[{"LenderCode":"Itau","SimulationId":"' || SIMULATION_ID ||'",'||
substr(SIMULATION_JSON, 2) || ']') as SIMULATION_JSON, PENDING_MERGE_STATUS
FROM customer_activity
where ROWNUM <= 1
returning SOT_PK into parentpk;
DBMS_OUTPUT.put_line('ParentPK=' || parentpk);
END

1) This query is not working, There is a syntax error in this


2) SIMULATION_JSON string operations should be done only if the column is not null
3) Need to run this in a loop for all the records in customer_activity table

You might also like