这是我的存储过程:
CREATE OR REPLACE
PROCEDURE "YOUQI_SP"
(
INPUT1 IN VARCHAR2,
INPUT2 IN VARCHAR2,
OUTPUT1 OUT VARCHAR2
)
AS
BEGIN
OUTPUT1 := INPUT1 || INPUT2;
DBMS_OUTPUT.PUT_LINE('INPUT1 : ' || INPUT1);
DBMS_OUTPUT.PUT_LINE('INPUT2 : ' || INPUT2);
DBMS_OUTPUT.PUT_LINE('OUTPUT1 : ' || OUTPUT1);
END YOUQI_SP;
执行没有问题:BEGIN YOUQI_SP('a', 'bc', :output1); END;
. 结果如下:
Array
(
[output1] => abc
)
Array
(
[0] => INPUT1 : a
[1] => INPUT2 : bc
[2] => OUTPUT1 : abc
)
但是,如果我在输入中再添加一个字符,我将收到错误消息:
[code] => 6502
[message] => ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at "YOUQI_SP", line 9 ORA-06512: at line 1
通过将变量直接分配给 进一步证明了这一点OUTPUT1
。它最多只能容纳 3 个字符。知道如何让它返回超过 3 个字符吗?谢谢!