CREATE OR REPLACE FUNCTION BUSCA_SITUACAO_COLETA_NF(
   P_CDFILIAL     IN ITEMPRODUTO.CDFILIAL%TYPE,
   P_NRLANCTONF   IN ITEMPRODUTO.NRLANCTONF%TYPE) RETURN VARCHAR2 IS

   V_QTITEMPROD   DOUBLE PRECISION;
   V_QTRESPRODPED DOUBLE PRECISION;
   V_QTPERADIC    DOUBLE PRECISION;
   V_VRPEADIEXP   DOUBLE PRECISION;
   V_EXISTE       INTEGER;
   V_RESULT       VARCHAR2(01); 
BEGIN

   SELECT COUNT(1)
     INTO V_EXISTE
      FROM RESERITEMPROD
    WHERE CDFILIAL = P_CDFILIAL 
      AND NRLANCTONF = P_NRLANCTONF;
   IF V_EXISTE > 0 THEN
      V_RESULT := 'S';
   ELSE
      V_RESULT := 'N';
   END IF;

   RETURN(V_RESULT);
END;