解决方案 »

  1.   

    if cursor1%found这个判断没必要给你去掉了
    ecom.hxd_proj_sku.catcode是啥?字符串吗?什么格式的?
    procedure Han_Lu_Test as
    cursor cursor1 is select catcode from HXD_PROJ_CATEGORY_STARTERMONTH;
    catcode1 cursor1%rowtype;
    begin
    open cursor1;
    loop
    fetch cursor1 into catcode1;
    exit when cursor1%notfound;
    if catcode1.catcode in (ecom.hxd_proj_sku.catcode)then
    --循环体......
    commit;
    end if;
    end loop;
    close cursor1;
    end;
      

  2.   

    catcode1.catcode in (ecom.hxd_proj_sku.catcode)这么写只有
    catcode1.catcode=ecom.hxd_proj_sku.catcode的时候才会返回true
    ecom.hxd_proj_sku.catcode会被解析成一个整体的元素
      

  3.   

    编译是没什么问题,关键是这个判断
    if catcode1.catcode in (ecom.hxd_proj_sku.catcode)then
    总是返回false,所以导致循环体未执行
    估计楼主就是纠结在为啥会返回false
    举个例子可能更好理解'1' in ('1','2','3')--此种写法返回TRUE
    '1' in ('1,2,3')--此种写法返回FALSE
      

  4.   

    在end loop 之前 还少一个 fetch cursor1 into catcode1; 吧?
      

  5.   

    不少,他前面的fetch在loop里面,再写就重复了,这么写也没啥问题
      

  6.   

    恩,再写fetch cursor1 into catcode1;  逻辑上可能就有问题了
      

  7.   

    的确如一楼所言,问题出在if catcode1.catcode in (ecom.hxd_proj_sku.catcode)then这句