create or replace procedure SP_PART_FAMILY(pPersonid IN char ,retcode out char ,retMsg out char)
存储过程的参数是这样的,带有两个输出参数,这两个参数是输出存储过程执行完毕后输出的反馈信息
在PL/SQL 中调用该存储过程时该如何写呢
我写的call SP_PART_FAMILY('123456','','')
后面两个输出参数不知道该怎么写了
问题比较简单大家帮帮忙了
存储过程的参数是这样的,带有两个输出参数,这两个参数是输出存储过程执行完毕后输出的反馈信息
在PL/SQL 中调用该存储过程时该如何写呢
我写的call SP_PART_FAMILY('123456','','')
后面两个输出参数不知道该怎么写了
问题比较简单大家帮帮忙了
begin
o:='nice';
dbms_output.put_line(t);
end pro5;SQL> declare
2 out1 varchar2(30);
3 begin
4 pro5('jejej',out1);
5 end;
6 /jejej
2 out1 varchar2(30);
3 begin
4 pro5('jejej',out1);
5 dbms_output.put_line(out1);
6 end;
7 /jejej
nice
v_retcode char ;
v_retMsg char;
begin
call SP_PART_FAMILY('123456',v_retcode,v_retMsg);
end
(retcode out char ,
retMsg out char) is
begin
select code,Msg into retcode ,retMsg from tab;
dbms_output.put_line(retcode,retMsg );
end SP_PART_FAMILY;SQL> set serveroutput on ;
SQL> variable retcode char;
SQL> variable retMsg char;
SQL> call SP_PART_FAMILY(:retcode ,:retMsg)
这种好像不行,出现了ora-06550错误
call SP_PART_FAMILY('123456',v_retcode,v_retMsg);
这种写法EXEC SP_PART_FAMILY('123456',v_retcode,v_retMsg);
把CALL 换成EXEC
传两个变量
[/Quote]
v_retcode char ;
v_retMsg char;
begin
SP_PART_FAMILY('123456',v_retcode,v_retMsg);
end ;
v_retcode char ;
v_retMsg char;
begin
call SP_PART_FAMILY('291012000000000698',v_retcode,v_retMsg);
end
执行这个之后出现这样的错误信息
--过程定义
create or replace procedure SP_PART_FAMILY(pPersonid IN varchar2 ,retcode out varchar2 ,retMsg out varchar2) is
begin
retcode := pPersonid;
retMsg := 'It is OK!';
end SP_PART_FAMILY;--过程执行
declare
v_retcode varchar2(64) ;
v_retMsg varchar2(12);
begin
SP_PART_FAMILY('291012000000000698',v_retcode,v_retMsg);
dbms_output.put_line(v_retcode);
dbms_output.put_line(v_retMsg);
end;--过程输出
291012000000000698
It is OK!
v_retcode char(10) ; --变量定义需要长度,存储过程参数不需要长度
v_retMsg char(10);
exec SP_PART_FAMILY('291012000000000698',:v_retcode,:v_retMsg); --变量前面加冒号表示输出print v_retcode; --打印结果
print v_retMsg ;上面直接拷贝到sqlplus里面就完了。
variable v_retcode char(10) ; --变量定义需要长度,存储过程参数不需要长度
variable v_retMsg char(10);
exec SP_PART_FAMILY('291012000000000698',:v_retcode,:v_retMsg); --变量前面加冒号表示输出 print v_retcode; --打印结果
print v_retMsg ;