CREATE OR REPLACE FUNCTION VALOR_MAOIR_NF
   (P_VRNOTAFISC IN NOTAFISCAL.VRNOTAFISC%TYPE) RETURN NUMBER
AS
   V_CDVALOR  VARCHAR2(02);
BEGIN
   IF ((P_VRNOTAFISC >= '50,01') AND (P_VRNOTAFISC <= '100,00')) THEN
      V_CDVALOR := '10';
   END IF;
   IF ((P_VRNOTAFISC >= '100,01') AND (P_VRNOTAFISC <= '200,00')) THEN
      V_CDVALOR := '11';
   END IF;
   IF ((P_VRNOTAFISC >= '100,01') AND (P_VRNOTAFISC <= '200,00')) THEN
      V_CDVALOR := '12';
   END IF;
   IF ((P_VRNOTAFISC >= '200,01') AND (P_VRNOTAFISC <= '300,00')) THEN
      V_CDVALOR := '13';
   END IF;
   IF ((P_VRNOTAFISC >= '300,01') AND (P_VRNOTAFISC <= '400,00')) THEN
      V_CDVALOR := '14';
   END IF;
   IF ((P_VRNOTAFISC >= '400,01') AND (P_VRNOTAFISC <= '500,00')) THEN
      V_CDVALOR := '15';
   END IF;
   IF ((P_VRNOTAFISC >= '500,01') AND (P_VRNOTAFISC <= '1000,00')) THEN
      V_CDVALOR := '16';
   END IF;
   IF (P_VRNOTAFISC >= '1000,01') THEN
      V_CDVALOR := '17';
   END IF;
   RETURN(V_CDVALOR);
END;
/


-- VERSAO --
BEGIN ATUVEROBJ('VALOR_MAOIR_NF','4.11.057'); END;
/

