I need to update a table column with values that are derieved. To add little more complexity, I need to concat a value based on the derivate and hence the value to append for concat is not always the same. I came up with this query, but it apparently has a problem executing.
update TRANSFER set PROCESS_STATUS = concat ( PREDICATE ,
(select dom_value from DOMAIN_VALUES dv where dv.val_id = st.sr_cashflow_status
CASE PREDICATE WHEN dv.dom_value = 'ZZZZ' THEN 'SPB'
WHEN dv.dom_value = 'XXXX' THEN 'SPB'
WHEN dv.dom_value = 'YYYY' THEN 'SPB'
ELSE 'DPS'
END )) from TRANSFER st
where PROCESS_STATUS is null;
My main problem is that how do I maintain the appender (here, predicate) as dynamic value that can be checked on the value obtained by join?
Any answers/directions much appreciated.
I guess you are trying to achieve something like below (considering
PREDICATEis a column inTRANSFERtable)-OR
A quick note on your
CASEstatement syntax. The syntax looks incorrect since you do not compare the outcome of theCASEwith anything since you are using this in aWHEREclause, also you are missingANDclause too.