你這樣的Result 的結果恆為false

解决方案 »

  1.   

    create or replace function Isinpost(
    postid in varchar2, 
    emplid in varchar2) 
    return boolean 
    is
    Result boolean;
    temp_postid varchar2(18);
    cursor c_temp_postid is 
    select postid from org_empl_in_post epost ,org_temp_in_post tpost where epost.emplid = tpost.grant_emplid(+) and tpost.authorized_emplid = emplid;
    cursor c_proxy_postid is 
    select Proxypostid from org_post_proxy ppost ,org_empl_in_post epost where ppost.authpostid = epost.postid(+) and epost.emplid = emplid;
      
    begin
      open c_temp_postid;
      loop
      fetch c_temp_postid into temp_postid;
      exit when c_temp_postid%notfound;
      if (temp_postid = postid) then
         Result := true;
      end if;
      
      end loop;
      close c_temp_postid;
      
      open c_proxy_postid;
      loop
      fetch c_proxy_postid into temp_postid;
      exit when c_proxy_postid%notfound;
      if temp_postid = postid then
         Result := true;
      end if;
      
      end loop;
      close c_proxy_postid;
      
      Result := false;
      return(Result);  
    end Isinpost;
    /