Oracle的PL/SQL

存储过程调用或接受另一存储过程返回的游标数据(Sys_refcursor类型)
 

--jdt4
declare
  v_total number(10,2):=0;  
  cursor c_orders is  --查所有订单信息
  select order_total from orders;
begin
  for total in c_orders 
  loop
    v_total:=v_total+total.order_total;
  end loop;
  if v_total<50000 then
    dbms_output.put_line('需提高订货额');
  elsif v_total>=50000 then
    dbms_output.put_line('已达到订货额');
  end if;
end;

  

猜你喜欢

转载自www.cnblogs.com/wzdnwyyu/p/11119341.html
今日推荐