A function of spell out number to in words (with JSP)
=======================================================
CREATE OR REPLACE FUNCTION spell_out (p_arg IN NUMBER)
RETURN VARCHAR2 IS
v_result VARCHAR2 (2000);
v_length NUMBER;
v_less_lakh VARCHAR2 (100);
v_crore VARCHAR2 (200);
v_length_crore NUMBER;
BEGIN
v_length := LENGTH (p_arg);
IF p_arg <= 99999 THEN
v_result := TO_CHAR (TO_DATE (p_arg, 'j'), 'Jsp') || 'Taka Only';
ELSIF v_length = 6 THEN
v_less_lakh :=
TO_CHAR (TO_DATE (SUBSTR (p_arg, 2), 'j'), 'Jsp')
|| ' Taka Only';
v_result :=
TO_CHAR (TO_DATE (SUBSTR (p_arg, 1, 1), 'j'), 'Jsp')
|| ' Lakh';
v_result := v_result || ' ' || v_less_lakh;
ELSIF v_length = 7 THEN
v_less_lakh :=
TO_CHAR (TO_DATE (SUBSTR (p_arg, 3), 'j'), 'Jsp')
|| ' Taka Only';
v_result :=
TO_CHAR (TO_DATE (SUBSTR (p_arg, 1, 2), 'j'), 'Jsp')
|| ' Lakh';
v_result := v_result || ' ' || v_less_lakh;
ELSIF v_length > 7 THEN
v_length_crore := v_length - 7;
v_crore :=
TO_CHAR (TO_DATE (SUBSTR (p_arg, 1, v_length_crore), 'j'), 'Jsp')
|| ' Crore';
v_result :=
TO_CHAR (TO_DATE (SUBSTR (p_arg, v_length_crore + 1, 2), 'j'),
'Jsp'
)
|| ' Lakh';
v_less_lakh :=
TO_CHAR (TO_DATE (SUBSTR (p_arg, v_length_crore + 3), 'j'), 'Jsp')
|| ' Taka Only';
v_result := v_crore || ' ' || v_result || ' ' || v_less_lakh;
END IF;
RETURN v_result;
END;
select to_char(to_date(substr(:p_arg,1,:v_length_crore),'j'),'Jsp')||' Crore' from dual
select to_char(to_date(:p_arg,'j'),'Jsp')||' Taka Only' from dual
select to_char(to_date(:p_arg,'j'),'Jsp') from dual
Halim, a Georgia Tech graduate Senior Database Engineer/Data Architect based in Atlanta, USA, is an Oracle OCP DBA and Developer, Certified Cloud Architect Professional, and OCI Autonomous Database Specialist. With extensive expertise in database design, configuration, tuning, capacity planning, RAC, DG, scripting, Python, APEX, and PL/SQL, he combines technical mastery with a passion for innovation. Notably, Halim secured 16th place worldwide in PL/SQL Challenge Cup Playoff on the year 2010.
Saturday, October 10, 2009
Subscribe to:
Post Comments (Atom)
My Blog List
-
-
-
ASSM states3 weeks ago
-
UKOUG Discover 20241 month ago
-
-
-
-
-
-
-
-
Moving Sideways8 years ago
-
-
Upcoming Events...11 years ago
-
9 comments:
Hi, Brother. i want to spell out in Bangla.
Example: (GK jvL Dwbk nvRvi UvKv gvÎ)
Example's font was sutonny MJ.
I want to spell out in bangla.
example: Dwbk nvRvi GKzk UvKv gvÎ
( Examples font was sutonny MJ )
I want to spell out in bangla.
example: Dwbk nvRvi GKzk UvKv gvÎ
( Examples font was sutonny MJ )
I want to spell out in bangla.
example: Dwbk nvRvi GKzk UvKv gvÎ
( Examples font was sutonny MJ )
I want to spell out in bangla.
example: Dwbk nvRvi GKzk UvKv gvÎ
( Examples font was sutonny MJ )
I want to spell out in bangla.
example: Dwbk nvRvi GKzk UvKv gvÎ
( Examples font was sutonny MJ )
I want to spell out in bangla.
example: Dwbk nvRvi GKzk UvKv gvÎ
( Examples font was sutonny MJ )
I want to spell out in bangla.
example: Dwbk nvRvi GKzk UvKv gvÎ
( Examples font was sutonny MJ )
I want to spell out in bangla.
example: Dwbk nvRvi GKzk UvKv gvÎ
( Examples font was sutonny MJ )
Post a Comment