Oracle 11g学习笔记(5)

关于非全字段查询结果的遍历问题,刚才笔记(4)里是一种方法还有一种方法则是:

  select_c4_sql := 'SELECT  TO_NUMBER(CM_NAIYO01) AS CM_NAIYO01_NUM,TO_NUMBER(CM_NAIYO02) AS CM_NAIYO02_NUM ' ||
                    'FROM KKT070 WHERE KIJUNCHI_KEISAN_NUMBER =: v1 AND SHIKIBETSU_ID =: v2 ' ||
        'ORDER BY  CM_NAIYO01_NUM DESC';
  OPEN c4 FOR select_c4_sql using rKKT090.KIJUNCHI_KEISAN_NUMBER,'Z017';

  lt_ext_flg := false;

  LOOP
          <<next_rec>>
          FETCH c4 INTO CM_NAIYO01_NUM,CM_NAIYO02_NUM;
          EXIT WHEN c4%NOTFOUND;
  IF CM_NAIYO01_NUM <= rKKT030.KOUNYU_TANKA_GENCHI_TSUKA THEN
      lt_ext_flg := true;
       END IF;
  END LOOP;

 

已检证。

posted on 2012-08-29 21:05  扭头撞到墙  阅读(153)  评论(0编辑  收藏  举报