如果CATEGORY_EXISTS = 0,则如何更新GT_ADD_ISBNS表,如果FINAL_DOCUMENTS不为null,则错误_mesage ='未找到类别' finalename = FINAL_DOCUMENTS,FINAL_DOCUMENTS为null然后error_mesage ='找不到文档';
SELECT (SELECT COUNT(*)
FROM
TEMP_NODE_PROPERTIES ANP,
TEMP_NODE_PROPERTIES ANPP,
TEMP_NODE AN
WHERE
ANP.NODE_ID=AN.ID AND
ANPP.NODE_ID=ANP.NODE_ID AND
AN.TYPE_QNAME='asset' AND
ANP.STRING_VALUE ='uPDF' AND ANPP.STRING_VALUE ='Entire PDF' AND
ANP.TYPE_QNAME='categories' AND
ANP.NODE_ID IN(SELECT CHILD_ID
FROM TEMP_CHILD_ASSOC START WITH PARENT_ID IN(
SELECT CHILD_ID FROM TEMP_CHILD_ASSOC WHERE NAME in(GT.ISBN))
CONNECT BY PRIOR CHILD_ID = PARENT_ID)
) CATEGORY_EXISTS,
(SELECT LISTAGG(T1.STRING_VALUE, ',') WITHIN GROUP (ORDER BY T1.STRING_VALUE)
FROM TEMP_NODE_PROPERTIES T1
WHERE T1.TYPE_QNAME='name' AND (T1.STRING_VALUE LIKE '%pdf%' AND T1.STRING_VALUE NOT LIKE '%pod%')
AND T1.NODE_ID IN (SELECT ANP.NODE_ID
FROM
TEMP_NODE_PROPERTIES ANP,
TEMP_NODE_PROPERTIES ANPP,
TEMP_NODE AN
WHERE
ANP.NODE_ID=AN.ID AND
ANPP.NODE_ID=ANP.NODE_ID AND
AN.TYPE_QNAME='asset' AND
ANP.STRING_VALUE ='uPDF' AND ANPP.STRING_VALUE ='Entire PDF' AND
ANP.TYPE_QNAME='categories' AND
ANP.NODE_ID IN(SELECT CHILD_ID
FROM TEMP_CHILD_ASSOC START WITH PARENT_ID IN(
SELECT CHILD_ID FROM TEMP_CHILD_ASSOC WHERE NAME in(GT.ISBN))
CONNECT BY PRIOR CHILD_ID = PARENT_ID)))
FINAL_DOCUMENTS
FROM GT_ADD_ISBNS GT;
答案 0 :(得分:0)
也许是这样的事情?
UPDATE gt_add_isbns
SET (error_message, filename) =
(SELECT CASE
WHEN category_exists = 0 THEN 'category not found'
WHEN final_documents IS NULL THEN 'documents not found'
END,
CASE
WHEN final_documents IS NOT NULL THEN final_documents
END
FROM (SELECT category_exists, final_documents
FROM (your current query goes here)));