存储过程-查询数据插入游标后循环输出

create or replace procedure p_update_03
as
 type balance is ref cursor;
 balanceDaylly balance;
 dealer_code VARCHAR2(70);
 
 begin
   open balanceDaylly for 
    select d.vin 
    from t_dms_03 d where d.vin in ('E3004185','E8011988','E8011992');
   loop
     fetch balanceDaylly into dealer_code;
     exit when balanceDaylly%notfound;
     dbms_output.put_line(dealer_code);
     end loop;
  end;
  
--执行
   begin  
      p_update_03;  
   end; 

--输出
E8011988
E3004185
E8011992
E8011992
E3004185
E8011988
E8011992

 

你可能感兴趣的:(存储过程)