Function to format the invoice number in AP

 Function to format the  invoice number in AP:


Please find the below steps for  Function to format the  invoice number in AP


CREATE OR REPLACE FUNCTION XXXX_VALIDATE_INVOICE(
    p_invoice_number VARCHAR2)
  RETURN VARCHAR2
AS
  l_result VARCHAR2(10) := ‘INVALID’;
BEGIN
  IF ((LENGTH(p_invoice_number) <> 13) OR (SUBSTR(p_invoice_number,5,1) <> ‘-‘) OR (NVL (LENGTH (TRIM (TRANSLATE (SUBSTR(p_invoice_number,1,4), ‘0123456789’, ‘ ‘))),0) > 0) OR (NVL (LENGTH (TRIM (TRANSLATE (SUBSTR(p_invoice_number,6), ‘0123456789’, ‘ ‘))),0) > 0)) THEN
    RETURN l_result;
  ELSE
    RETURN ‘VALID’;
  END IF;
EXCEPTION
WHEN OTHERS THEN
  RETURN l_result;

END IRON_VALIDATE_INVOICE; 

  • February 5, 2019 | 16 views
  • Comments