我有以下更新,但我不想手动复制值。 我更喜欢使用查询提取它们。 我应该使用PL / SQL还是有SQL配方?
我用来获取我手动复制到更新中的值的查询不是密钥保留(“连接视图中的密钥保留表概念”)。
UPDATE wkf_cronologia
SET swkf_stato_workflow_id = 'o3gE1tlSdcDIC6FF',
swkf_data_ini = TO_TIMESTAMP ('19-06-2010 18:28:10,556000000','DD-MM-RRRR HH24:MI:SS,FF'),
swkf_versione = 0,
SPWKF_STATO_PUBBLICO_ID = '*1UNICOO',
SPWKF_DATA_INI = TO_TIMESTAMP ('01-01-0001 00:00:00,000000000', 'DD-MM-RRRR HH24:MI:SS,FF'),
SPWKF_VERSIONE = 0
WHERE wkfc_cronologia_id = 'ApAJ0qCudNphjLxj';
答案 0 :(得分:1)
您可以使用子查询:
UPDATE wkf_cronologia
SET (swkf_stato_workflow_id,
swkf_data_ini,
swkf_versione,
SPWKF_STATO_PUBBLICO_ID,
SPWKF_DATA_INI,
SPWKF_VERSIONE) = (select a,b,0,c,d,e
from another_table
where something=wkf_cronologia.swkf_stato_workflow_id)
WHERE swkf_versione is null;