0
這可能是非常基本的。我是PL/SQL的初學者,但我堅持這個問題。如果有人知道解決方案,請告訴我。PL/SQL如何賦值變量?
此代碼
DECLARE
v_objectID VARCHAR2(100);
v_account VARCHAR2(100);
BEGIN
v_objectID :='21,22';
DBMS_OUTPUT.PUT_LINE(v_objectID);
END;
/
輸出是
21,22
然後,
此代碼
DECLARE
v_objectID VARCHAR2(100);
v_account VARCHAR2(100);
BEGIN
SELECT LISTAGG(x.ACCOUNT, ',') WITHIN GROUP (ORDER BY NULL) AS ACCOUNT
INTO v_account
FROM acctx x
where x.OBJECT_ID IN (21,22);
DBMS_OUTPUT.PUT_LINE(v_account);
END;
/
OUTPUT是
1001,2002
然後我嘗試做這樣的
DECLARE
v_objectID VARCHAR2(100);
v_account VARCHAR2(100);
BEGIN
v_objectID :='21,22';
SELECT LISTAGG(x.ACCOUNT, ',') WITHIN GROUP (ORDER BY NULL) AS ACCOUNT
INTO v_account
FROM acctx x
where x.OBJECT_ID IN (v_objectID);
DBMS_OUTPUT.PUT_LINE(v_account);
END;
/
我加v_objectID:= '21,22' ;;這是造成問題
的錯誤是
ORA_07122:無效的號碼 ORA-06512:在第9行
我應該如何分配變量適當地輸出1001,2002?
感謝