Oracle存储过程实例2

create or replace package body CESHIPACK


is
--声明游标
cursor mycurso is select * from test1;
       
  Procedure show_Ceshi(list out outlist,ceshiName varchar2,numReturn out number)
  
  is
    --变量
    v_1 varchar2(100);
  begin
    select department_name into v_1 from test1 where department_id=290;
    dbms_output.put_line(v_1);
    
    --用游标循环处理  输出数据
    for c_1 in mycurso 
      loop
        dbms_output.put_line(c_1.department_name); 
        dbms_output.put_line(c_1.department_id);
      end loop; 
      
    --游标变量返回结果集
    open list for select * from test1;
    
    --返回参数
    insert into test1 values(310,'欧洲',119,1000);
    /*returning 310 into numReturn;--返回值 赋值方法*/
    numReturn:=310;--赋值


    
    --传入参数
    select department_id into numReturn from test1 where department_name=ceshiName;
    
  end show_Ceshi;
end CESHIPACK; 

你可能感兴趣的:(oracle,c,list,存储,insert,returning)