[20180502]PLDEVELOP与存储过程调试.txt
--//今天遇到一个调式问题.做一个记录:
1.环境:
SCOTT@book> @ ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
--//建立过程如下:
CREATE OR REPLACE PROCEDURE oratest (a VARCHAR2, b VARCHAR2)
AS
c VARCHAR2(32767);
BEGIN
c := a || b;
DBMS_OUTPUT.put_line (a || b);
END oratest;
/
--//另外写法:
CREATE OR REPLACE PROCEDURE oratest1 (a VARCHAR2, b VARCHAR2)
AS
c VARCHAR2(32767);
BEGIN
c := a || b;
DBMS_OUTPUT.put_line (c);
END oratest;
/
SCOTT@book> exec oratest(lpad('a',255,'a'),'b');
aaaaaaaaaaaaaa....
aaaab
PL/SQL procedure successfully completed.
--//在sqlplus以及toad下执行如下:
DECLARE
A VARCHAR2(32767);
B VARCHAR2(32767);
BEGIN
A := lpad('a',255,'a');
B := 'b';
SCOTT.ORATEST ( A, B );
COMMIT;
END;
/
2.但是如果使用pl develop的test windows:
begin
-- Call the procedure
oratest(a => :a,
b => :b);
end;
--//如果输入参数字符串总和长度大于255,就会出现错误:
ORA-06502:PL/SQL:number or value error: host bind array too small.
--//即使type选择PL/SQL string也是一样.
--//我使用PL的版本 6.0.0.840.
https://blog.csdn.net/zzy7075/article/details/8559358
--//经过分析,在客户端为9i的机器上运行这个sql,其最大长度限制是255,在10g上运行,最大长度限制是32767.
--//找了一台9i的windows服务器测试看看.
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
PL/SQL Release 9.2.0.8.0 - Production
CORE 9.2.0.8.0 Production
TNS for 32-bit Windows: Version 9.2.0.8.0 - Production
NLSRTL Version 9.2.0.8.0 - Production
SQL> CREATE OR REPLACE PROCEDURE oratest (a VARCHAR2, b VARCHAR2)
2 AS
3 c VARCHAR2(32767);
4 BEGIN
5 c := a || b;
6 DBMS_OUTPUT.put_line (a || b);
7 END oratest;
8 /
过程已创建。
SQL> set serverout on
SQL> exec oratest(lpad('a',255,'a'),'b');
BEGIN oratest(lpad('a',255,'a'),'b'); END;
*
ERROR 位于第 1 行:
ORA-20000: ORU-10028: line length overflow, limit of 255 chars per line
ORA-06512: 在"SYS.DBMS_OUTPUT", line 35
ORA-06512: 在"SYS.DBMS_OUTPUT", line 133
ORA-06512: 在"SYSTEM.ORATEST", line 6
ORA-06512: 在line 1
SQL> exec oratest(lpad('a',254,'a'),'b');
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaab
PL/SQL 过程已成功完成。
SQL> set serveroutput on size 10000
SQL> exec oratest(lpad('a',255,'a'),'b');
BEGIN oratest(lpad('a',255,'a'),'b'); END;
*
ERROR 位于第 1 行:
ORA-20000: ORU-10028: line length overflow, limit of 255 chars per line
ORA-06512: 在"SYS.DBMS_OUTPUT", line 35
ORA-06512: 在"SYS.DBMS_OUTPUT", line 133
ORA-06512: 在"SYSTEM.ORATEST", line 6
ORA-06512: 在line 1
--//我的pl/develop的client是10.2.0,难道里面的某些dll版本还是9i的东西.放弃,好在我不用pl/delelop.不过开发遇到这个问题,以后工作注意.
--//另外好像在拼接时开始报错...