Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Json format:
{
"attributeValue":[
{
"specName":"CUSTOMER_ID",
"specValue":"112345"
},
{
"specName":"CUSTOMER_TYPE",
"specValue":"12"
},
{
"specName":"CUSTOMER_FEATURES",
"specValue":"REPORT_GENERATION",
"specValueId":"223"
},
]
}
i might get n number of specname and spec value from the json object. extract the value dynamically and update or insert into target table.
In the above scenario
if a record is not present we will INSERT if record is already present we will update the value. how we can extract the column name and column value dynamically and insert or update the record (customer_id is primary key).
if we can not do dynamically say if we have fixed column names and column value how to do that.
below is expectation when we run the job it will read the json object and insert/update the target table data based on json object.
insert into customer(customer_id,CUSTOMER_TYPE,CUSTOMER_FEATURES,REPORT_TYPE) VALUES
(112345,12,'REPORT_GENERATION',223);