我尝试使用此查询在表之间复制值:
MERGE INTO workflow W
USING (
SELECT distinct pr.workflow_id, pr.name, pr.description FROM workflow_revision pr, workflow pw WHERE pw.id = pr.workflow_id
)WR
ON ( W.id = WR.workflow_id )
WHEN MATCHED THEN
UPDATE SET W.name = WR.name, W.description = WR.description
但是它给出了以下错误:ORA-00932: inconsistent datatypes: expected - got CLOB
从查询中删除该说明列后,它可以正常工作。这是一个长文本。
我只是不知道该如何解决。你能帮我吗?
@Lukasz Szozda提交后,我以此为答案:
MERGE INTO workflow W
USING (
SELECT workflow_id, name, (CAST (description AS VARCHAR2(4000))) AS description FROM workflow_revision
)WR
ON (W.id = WR.workflow_id)
WHEN MATCHED THEN
UPDATE SET W.name = WR.name, W.description = WR.description;
但是正如他也警告过的那样;只要描述列的最大长度为4000(或您在其中输入的值)为最大,这就是一个可行的答案。
答案 0 :(得分:1)
不需要JOIN
:
MERGE INTO workflow W
USING (SELECT workflow_id, name, description FROM workflow_revision)WR
ON (W.id = WR.workflow_id)
WHEN MATCHED THEN
UPDATE SET W.name = WR.name, W.description = TO_LOB(WR.description);