plsql 跳出本次循环进入下一次循环

DECLARE
  CURSOR c_shipres IS
    SELECT rosp.shipment_plan_id,
           rosp.contract_number, --合同号
           rosp.order_number,    --订单号
           rosp.line_number,     --行号
           rosp.sub_inventory_name,
           rosp.mes_plan_weight,
           rosp.mes_plan_quantity
      FROM rz_om_shipment_plan_all rosp
     WHERE rosp.handle_state = 'S';
BEGIN

  FOR l_shipres IN c_shipres LOOP
    IF l_shipres.shipment_plan_id = 20130515001 THEN
      GOTO next_loop;
    END IF;
     dbms_output.put_line(l_shipres.shipment_plan_id);--当l_shipres.shipment_plan_id = 20130515001时,这条记录不会打印出来,而是直接跳到循环下一个记录
    <>
    NULL; --不可少
  END LOOP;
EXCEPTION
  WHEN OTHERS THEN
     dbms_output.put_line('exception');
  
END;

你可能感兴趣的:(PL/SQL)