Tuesday 11 June 2013

Easiest way to convert Amount in Word

Here :p_amount is taken as parameter.

1. FOR ORACLE APPS USERS

   SELECT    'Rupees '
       || ap_amount_utilities_pkg.ap_convert_number (TRUNC (:p_amount))
       || ' And '
       || ap_amount_utilities_pkg.ap_convert_number (ROUND (  (  :p_amount
                                                               - TRUNC
                                                                    (:p_amount)
                                                              )
                                                            * 100
                                                           )
                                                    )
       || ' Paise.' amt_in_word
   FROM DUAL;

Note :-  Maximum amount allowed is ( 10 power 12 ) before as well as after decimal.

2. FOR NON ORACLE APPS USERS

  SELECT    'Rupees '
       || TO_CHAR (TO_DATE (TRUNC (:p_amount), 'J'), 'jsp')
       || ' And '
       || TO_CHAR (TO_DATE (ROUND ((:p_amount - TRUNC (:p_amount)) * 100),
                            'J'),
                   'jsp'
                  )
       || ' Paise.' amt_in_word
  FROM DUAL;

Note :- Amount should not exceed 537348

No comments:

Post a Comment