declare
DOCUMENT_NAME constant varchar2(128) := 'GOODS_IN_TRANSIT_BRAZIL_DAILY';
JIRA_TASK constant varchar2(128) := 'REPSCML-47';
l_batch_id etl.batchId;
begin
l_batch_id := etl.startBatch(JIRA_TASK || ' : logistic corridors', etl.BATCH_BLOCK_UPDATE);
etl.lockDocumentBy(DOCUMENT_NAME, l_batch_id);
etl.userChainCode(
p_batch_id => l_batch_id,
p_document_name => DOCUMENT_NAME,
p_description => 'update logisticSite, logisticCorridor, logisticCorridorName',
p_code => q'[
update "goodsInTransitBrazilDaily" t
set (t."logisticSite", t."logisticCorridor", t."logisticCorridorName") =
( select c."site", c."corridor", c."corridorName"
from xxmdg."logisticCorridors" c
where c."sapCode" = t."plantId"
fetch first row only
)
]'
);
etl.finalizeBatch(l_batch_id);
end;
/