0
幫助請在創建函數時發現錯誤,它將從列表返回一行。LISTAGG IN PL/SQL
SELECT listagg(' ' || V_RECEIVING_LIST.DOCUMENT_NUMBER || CHR(13))
WITHIN GROUP (ORDER BY V_RECEIVING_LIST.DOCUMENT_NUMBER)
FROM svc.claim_detail, tbc.v_receiving_list
WHERE claim_detail.id_claim = 334455
AND V_RECEIVING_LIST.ID_RECEIVING_LIST = CLAIM_DETAIL.ID_RECEIVING_LIST
該代碼返回正確的結果。
但接下來不返回相同。
DECLARE
scodes VARCHAR2 (4000);
BEGIN
SELECT (LISTAGG(' ' || RECEIVING_LIST.DOCUMENT_NUMBER || CHR(13))
WITHIN GROUP (ORDER BY RECEIVING_LIST.DOCUMENT_NUMBER))
INTO scodes
FROM svc.claim_detail, tbc.v_receiving_list
WHERE claim_detail.id_claim = 334455
AND RECEIVING_LIST.ID_RECEIVING_LIST = CLAIM_DETAIL.ID_RECEIVING_LIST;
DBMS_OUTPUT.PUT_LINE(scodes);
END;
什麼的PL/SQL塊顯示器? SQL查詢返回什麼? –
下面的示例「答案」僅顯示一行輸出(我可以看到)。所以有什麼問題? 什麼是獨立的SQL返回與您的答案不同? – StewS2