要使用存储过程A调用另一个实例下的存储过程B,B返回x,y,z三个值,将这三个值给A的三个返回值o,p,q。
请问A的存储过程如何写?

解决方案 »

  1.   


    SQL> create or replace procedure proB(x out int,y out int,z out int)
      2  as
      3  begin
      4    x := 1;
      5    y := 2;
      6    z := 3;
      7    dbms_output.put_line(to_char(x)||to_char(y)||to_char(z));
      8  end;
      9  /Procedure createdExecuted in 0.032 secondsSQL> 
    SQL> create or replace procedure proA(o out int,p out int,q out int)
      2  as
      3    t1 int;
      4    t2 int;
      5    t3 int;
      6  begin
      7    proB(t1,t2,t3);
      8    o := t1+1;
      9    p := t2+1;
     10    q := t3+1;
     11    dbms_output.put_line(to_char(o)||to_char(p)||to_char(q));
     12  end;
     13  /Procedure createdExecuted in 0.031 secondsSQL> 
    SQL> declare
      2    x1 int;
      3    y1 int;
      4    z1 int;
      5  begin
      6    proB(x1,y1,z1);
      7    dbms_output.put_line(to_char(x1)||to_char(y1)||to_char(z1));
      8  end;
      9  /123
    123PL/SQL procedure successfully completedExecuted in 0 secondsSQL> 
    SQL> declare
      2    o1 int;
      3    p1 int;
      4    q1 int;
      5  begin
      6    proA(o1,p1,q1);
      7    dbms_output.put_line(to_char(o1)||to_char(p1)||to_char(q1));
      8  end;
      9  /123
    234
    234PL/SQL procedure successfully completedExecuted in 0 seconds
      

  2.   

    一直没有找到在ORACLE下嵌套存储过程的语句,谢谢!
    如果要调用远程数据库上的存储过程
    那么这句
    proB(x1,y1,z1);
    是不是应该修改为
    proB@dblink1(x1,y1,z1);
    其中dblink1为创建的数据链路