包头:
create or replace package system.select_table is
  type tab_04 is record(
    itnum_1 varchar2(1),
    itnum_2 varchar2(1),
    itnum_3 varchar2(1),
    itnum_4 varchar2(1));
  type tab_05 is record(
    itnum_1 varchar2(1),
    itnum_2 varchar2(1),
    itnum_3 varchar2(1),
    itnum_4 varchar2(1),
    itnum_5 varchar2(1));
type cur_4 is ref cursor return tab_04;
type cur_5 is ref cursor return tab_05;
end select_table;我建的存储过程:
create or replace procedure student_grade
(cur out select_table.cur_4)
as
begin
  open cur for
  select xs.xh,xs.xm,kc.kcm,xs_kc.cj from xs,xs_kc,system.kc
  where xs.xh=xs_kc.xh and xs_kc.kch=kc.kch;
  commit;
end student_grade;调用过程时出错(以上内容都正确建立):
begin
student_grade;   /*调过"student_garde"时参数个数或类型出错*/
end;请问怎么调用存储过程,我写的可能不对。我不知道正确的应该怎么写。

解决方案 »

  1.   

    CREATE OR REPLACE PROCEDURE SYSTEM.xscjprocedure
    (cxh  in out xscjtable.xh%type,                                         
     cxm  in out xscjtable.xm%type,
     ckcm in out xscjtable.kcm%type,
     ccj  in out xscjtable.cj%type) 
     as
    begin  select xs.xh, xs.xm, kc.kcm, xs_kc.cj
        into cxh, cxm, ckcm, ccj
        from system.xs, xs_kc, system.kc
       where xs.xh = xs_kc.xh
         and xs_kc.kch = kc.kch;
      commit;
    end xscjprocedure;
    这个也是我建立的存储过程。
      

  2.   

    student_grade有一个输出参数
    存储过程调用的时候,参数个数要与定义时相同declare
    v_cur   select_table.cur_4;
    begin
    student_grade(v_cur);   /*调过"student_garde"时参数个数或类型出错*/
    end;