OPEN get_attr;              
  LOOP
    FETCH get_attr   INTO account_;
    EXIT WHEN get_attr%NOTFOUND;
      OPEN get_code_c_attr;
      LOOP
          FETCH get_code_c_attr INTO code_c_;
          EXIT WHEN get_code_c_attr%NOTFOUND; 
            if (hasfs(Company_, year_, PreiodStart_, PreiodEnd_,account_,BhWjz_) ) then 
               TJSJ(report_key_,Company_ , year_, PreiodStart_, PreiodEnd_,BhWjz_,showye_,showfse_,account_,code_c_,AccountStart_,AccountEnd_,CODECStart_,CODECEnd_); 
            end if;
      END LOOP;   END LOOP;
这段代码中“OPEN get_code_c_attr;”运行到此处,总是提示“游标已打开”,请高手帮忙分析一下,急用,谢谢

解决方案 »

  1.   

    OPEN get_attr;              
      LOOP
        FETCH get_attr   INTO account_;
        EXIT WHEN get_attr%NOTFOUND;
          OPEN get_code_c_attr;
          LOOP
              FETCH get_code_c_attr INTO code_c_;
              EXIT WHEN get_code_c_attr%NOTFOUND; 
                if (hasfs(Company_, year_, PreiodStart_, PreiodEnd_,account_,BhWjz_) ) then 
                   TJSJ(report_key_,Company_ , year_, PreiodStart_, PreiodEnd_,BhWjz_,showye_,showfse_,account_,code_c_,AccountStart_,AccountEnd_,CODECStart_,CODECEnd_); 
                end if;
          END LOOP;
          close  get_code_c_attr;   END LOOP;
    close get_attr;   
    有OPEN就要有CLOSE,其实可以用隐性游标,自动打开关闭的
      

  2.   

      If cursor_name%ISOPEN then
        close cursor_name;