create or replace FUNCTION GET_IMPOSTO_ITEM(
    PARAM_CDFILIAL IN IMPITEMPEDIDO.CDFILIAL%TYPE,
    PARAM_NRPEDIDO IN IMPITEMPEDIDO.NRPEDIDO%TYPE,
    PARAM_NRITEMPED IN IMPITEMPEDIDO.NRITEMPED%TYPE,
    PARAM_CDIMPOSTONFE IN IMPOSTO.CDIMPOSTONFE%TYPE
)RETURN FLOAT
IS
   IMPOSTOTOTAL FLOAT;
BEGIN
   IMPOSTOTOTAL := '0';
   SELECT SUM(VRIMPOSTOITPED) AS VALOR_IMPOSTO
     INTO IMPOSTOTOTAL
     FROM IMPITEMPEDIDO IP, IMPOSTO I
    WHERE CDFILIAL = PARAM_CDFILIAL
      AND NRPEDIDO = PARAM_NRPEDIDO
      AND NRITEMPED = PARAM_NRITEMPED
      AND IP.CDIMPOSTO = I.CDIMPOSTO
      AND I.CDIMPOSTONFE = PARAM_CDIMPOSTONFE;
   return IMPOSTOTOTAL;
END;
/