Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Md.Arif.

Asked: March 10, 2018 - 3:59 pm UTC

Last updated: July 08, 2019 - 3:10 am UTC

Version: 11g or upper

Viewed 1000+ times

You Asked

Dear Sir,

Is there any way to convert number from english to other language like Bangla.

e.g =

1 will be show when convert ১

is possible.............

and we said...


There is no built-in conversion from number to text (spelling out) other than to English in the Oracle Database. You need to look for third-party PL/SQL packages that could do this.

However, what you really seem to ask for is a simple European-to-Bangla digit translation. You can use the TRANSLATE function for this purpose:

select translate(to_char(123456789.01,'fm99G99G99G99G99G99G990D99','nls_numeric_characters=''.,'''),
                 '0123456789','০১২৩৪৫৬৭৮৯')
from dual;


This is not a universal solution. You need different TRANSLATE calls for different Indian scripts.

Note to AskTOM readers: your browser must be properly configured to display the Bengali script for the code example to be legible.


Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Md.Arif Hossain, March 13, 2018 - 5:26 pm UTC

I have already done the work using below function


create or replace FUNCTION ennumber2bnnumber (in_value NUMBER)
RETURN VARCHAR2
IS
p_num VARCHAR2 (100) := TO_CHAR (in_value);
p_char CHAR (1);
o_str NUMBER := 14722982;
V_A VARCHAR2 (500);
BEGIN
/***************************************************
* This function was created by Md. Arif Hossain *
***************************************************/

FOR i IN 1 .. LENGTH (p_num)
LOOP
p_char := SUBSTR (p_num, i, 1);

IF p_char = '.'
THEN
o_str := 46;
ELSE
o_str := 14722982 + TO_NUMBER (p_char);
END IF;

V_A := V_A || CHR (o_str);
END LOOP;
RETURN V_A;
END;

Sergiusz Wolicki
March 13, 2018 - 8:14 pm UTC

The solution that I gave should be faster. Also, it allows you to set the group (thousand) separator correctly, if desired, and it will work in a BN8BSCII database, not only in an AL32UTF8 database. The disadvantage compared to your solution is that the explicit Bangla literal requires taking care of the encoding of the script that contains it. The recommended encoding is UTF-8 (AL32UTF8).

CREATE OR REPLACE FUNCTION ennumber2bnnumber (in_value NUMBER)
RETURN VARCHAR2 IS
BEGIN
  RETURN TRANSLATE(TO_CHAR(in_value,'fm99G99G99G99G99G99G990D99',
                                    'nls_numeric_characters=''.,'''),
                   '0123456789','০১২৩৪৫৬৭৮৯');
END;
/


I need to translate Sting English to Banglai

Syed Abdul Ahad, July 07, 2019 - 8:52 am UTC

Dear Concern
Please be inform me how may I translate
'One hundred fifty one' to in Banglai 'এক শত পঞ্চাশ'

Best Regards
Syed Abdul Ahad.
Connor McDonald
July 08, 2019 - 3:10 am UTC

You need a 3rd party tool for that.

Some people have explored webservices for that, some examples here

https://community.oracle.com/thread/1124273?start=15&tstart=0

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library