在SQL*plus中写的如下DECLARE
WREN4255 VARCHAR(20);
WREN42554255 VARCHAR(30);
BEGIN
WREN4255 := '0';
WREN42554255 := 'JUST A TEST';
XXAE03103.main(WREN42554255,WREN4255);
END;
/
数据库中定义的包XXAE03103如下
CREATE OR REPLACE PACKAGE BODY APPS.XXAE03103
IS
PROCEDURE main(errbuf OUT VARCHAR2
,retcode OUT VARCHAR2)
IS
BEGIN
DBMS_OUTPUT.PUT_LINE(retcode||'1111');
END main;
END XXAE03103;
/
为什么retcode的值为空呢??
------解决方案--------------------
参数类型错误。
PROCEDURE main中定义的是out类型的参数,又不是in out类型的参数。
------解决方案--------------------
楼上正解
------解决方案--------------------
- SQL code
declare errbuf varchar2(20) default '0' ;retcode varchar2(30) default 'JUST A TEST' ;begindbms_output.put_line(retcode||'1111'); end;
------解决方案--------------------
- SQL code
SQL> create or replace package XXAE03103 2 is 3 procedure main(errbuf in VARCHAR2 ,retcode OUT VARCHAR2); 4 end XXAE03103; 5 /Package createdSQL> CREATE OR REPLACE PACKAGE BODY XXAE03103 2 IS 3 PROCEDURE main(errbuf in VARCHAR2 ,retcode OUT VARCHAR2) 4 IS 5 BEGIN 6 retcode := errbuf||'testing.....'; 7 END main; 8 END XXAE03103; 9 /Package body createdSQL> DECLARE 2 WREN4255 VARCHAR(20); 3 WREN42554255 VARCHAR(30); 4 5 BEGIN 6 WREN42554255 := '00000'; 7 XXAE03103.main(WREN42554255,WREN4255); 8 dbms_output.put_line(WREN4255); 9 END; 10 /00000testing.....PL/SQL procedure successfully completed
------解决方案--------------------
楼猪是输入的参数
在proc中 in 也可,in out也可