Number To Indian Rupee Words in Oracle Forms / Reports
Posted ORACLE EBS
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Number To Indian Rupee Words in Oracle Forms / Reports相关的知识,希望对你有一定的参考价值。
Convert numbers to Indian Rupees format in Oracle Forms / Reports.
Create the below mention function in Oracle Forms / Reports and call it with passing a number parameter.
FUNCTION INR_words( p_number In number, vFrDec varchar2 Default ‘Paisa Only‘)
RETURN varchar2 As
TYPE myArray Is Table Of varchar2(255);
TYPE myArray2 Is Table Of varchar2(255);
l_str myArray := myArray( ‘‘,
‘ Thousand ‘, ‘ Lac ‘,
‘ Crore ‘, ‘ Arab ‘,
‘ Kharab ‘, ‘ quintillion ‘,
‘ Sextillion ‘, ‘ Septillion ‘,
‘ Octillion ‘, ‘ Nonillion ‘,
‘ Decillion ‘, ‘ Undecillion ‘,
‘ Duodecillion ‘ );
l_str2 myArray2 := myArray2(‘Rs Paisa‘, ‘$ Pany‘);
l_num varchar2(50) Default Trunc( p_number );
l_dec varchar2(50) Default Substr(To_Char(p_number - Trunc(p_number), ‘.99‘),2);
l_return varchar2(4000);
j number := 3;
BEGIN
For i In 1 .. l_str.Count
LOOP
EXIT When l_num Is Null;
IF ( Substr(l_num, Length(l_num)-(j-1), j) <> 0 ) Then
l_return := To_Char(To_Date(
Substr(l_num, Length(l_num)-(j-1), j),‘J‘ ), ‘Jsp‘ ) || l_str(i) || l_return;
END IF;
l_num := Substr( l_num, 1, Length(l_num)-j );
j:=2;
END LOOP;
IF l_dec > 0 Then
l_return := rtrim(l_return) || ‘ and ‘ || rtrim(inr_words(Substr(l_dec,2), Null)) || ‘ ‘ || rtrim(Initcap(vFrdec));
END IF;
RETURN Replace(l_return, ‘-‘, ‘ ‘);
END;
Create the below mention function in Oracle Forms / Reports and call it with passing a number parameter.
FUNCTION INR_words( p_number In number, vFrDec varchar2 Default ‘Paisa Only‘)
RETURN varchar2 As
TYPE myArray Is Table Of varchar2(255);
TYPE myArray2 Is Table Of varchar2(255);
l_str myArray := myArray( ‘‘,
‘ Thousand ‘, ‘ Lac ‘,
‘ Crore ‘, ‘ Arab ‘,
‘ Kharab ‘, ‘ quintillion ‘,
‘ Sextillion ‘, ‘ Septillion ‘,
‘ Octillion ‘, ‘ Nonillion ‘,
‘ Decillion ‘, ‘ Undecillion ‘,
‘ Duodecillion ‘ );
l_str2 myArray2 := myArray2(‘Rs Paisa‘, ‘$ Pany‘);
l_num varchar2(50) Default Trunc( p_number );
l_dec varchar2(50) Default Substr(To_Char(p_number - Trunc(p_number), ‘.99‘),2);
l_return varchar2(4000);
j number := 3;
BEGIN
For i In 1 .. l_str.Count
LOOP
EXIT When l_num Is Null;
IF ( Substr(l_num, Length(l_num)-(j-1), j) <> 0 ) Then
l_return := To_Char(To_Date(
Substr(l_num, Length(l_num)-(j-1), j),‘J‘ ), ‘Jsp‘ ) || l_str(i) || l_return;
END IF;
l_num := Substr( l_num, 1, Length(l_num)-j );
j:=2;
END LOOP;
IF l_dec > 0 Then
l_return := rtrim(l_return) || ‘ and ‘ || rtrim(inr_words(Substr(l_dec,2), Null)) || ‘ ‘ || rtrim(Initcap(vFrdec));
END IF;
RETURN Replace(l_return, ‘-‘, ‘ ‘);
END;
以上是关于Number To Indian Rupee Words in Oracle Forms / Reports的主要内容,如果未能解决你的问题,请参考以下文章
1342. Number of Steps to Reduce a Number to Zero
leetcode 1342. Number of Steps to Reduce a Number to Zero