create or replace procedure SP_PART_FAMILY(pPersonid IN char ,retcode out char ,retMsg out char)
存储过程的参数是这样的,带有两个输出参数,这两个参数是输出存储过程执行完毕后输出的反馈信息
在PL/SQL 中调用该存储过程时该如何写呢
我写的call SP_PART_FAMILY('123456','','')
后面两个输出参数不知道该怎么写了
问题比较简单大家帮帮忙了

解决方案 »

  1.   

    create or replace procedure pro5(t in varchar2,o out nvarchar2) is
    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.   

    SQL>  declare
      2  out1 varchar2(30);
      3  begin
      4  pro5('jejej',out1);
      5  dbms_output.put_line(out1);
      6  end;
      7  /jejej
    nice
      

  3.   

    declare 
     v_retcode char ;
     v_retMsg  char;
    begin
      call SP_PART_FAMILY('123456',v_retcode,v_retMsg);
    end
      

  4.   

    给个例子create or replace procedure SP_PART_FAMILY
                                          (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)
      

  5.   


    这种好像不行,出现了ora-06550错误
      

  6.   

     
      call SP_PART_FAMILY('123456',v_retcode,v_retMsg);
     这种写法EXEC SP_PART_FAMILY('123456',v_retcode,v_retMsg);
    把CALL  换成EXEC
    传两个变量
    [/Quote]
      

  7.   

    declare 
       v_retcode char ; 
       v_retMsg  char; 
    begin 
      SP_PART_FAMILY('123456',v_retcode,v_retMsg); 
    end ;
      

  8.   

    换成exec 之后还是一样的错误信息
      

  9.   

    EXEC SP_PART_FAMILY('123456',:v_retcode,:v_retMsg); 
      

  10.   

    declare
    v_retcode char ;
    v_retMsg  char;
    begin
     call SP_PART_FAMILY('291012000000000698',v_retcode,v_retMsg);
    end
    执行这个之后出现这样的错误信息
      

  11.   

    pl/sql的SQL窗不认识call、exec,它们均为命令行命令。直接存储过程名,跟上参数就好了。如果要在PL/SQL命令窗执行,则和SQLPLUS下一样。
      

  12.   

    你定义的是char类型,不能传一个字符串进去。你可以改成varchar2类型。
    --过程定义
    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!
      

  13.   

    declare
    v_retcode char(10) ; --变量定义需要长度,存储过程参数不需要长度
    v_retMsg  char(10);
    exec   SP_PART_FAMILY('291012000000000698',:v_retcode,:v_retMsg); --变量前面加冒号表示输出print v_retcode; --打印结果
    print v_retMsg ;上面直接拷贝到sqlplus里面就完了。
      

  14.   

    不好意思,应该是这样
    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 ;