Reputation: 13
i have table and the data like this
and i need to select this data but i need it to be like this
how to convert the number from English to arabic
Upvotes: 1
Views: 3410
Reputation: 167981
Oracle 11g R2 Schema Setup:
CREATE FUNCTION numToEasternArabic(
in_value IN NUMBER
) RETURN NVARCHAR2 DETERMINISTIC
IS
p_num VARCHAR2(100) := TO_CHAR( in_value );
p_char CHAR(1);
o_str NVARCHAR2(100);
BEGIN
FOR i IN 1 .. LENGTH( p_num ) LOOP
p_char := SUBSTR( p_num, i, 1 );
o_str := o_str
|| CASE p_char
WHEN '.'
THEN N'.'
ELSE UNISTR(
'\' || TO_CHAR(
TO_NUMBER( p_char ) + 660,
'FM0000'
)
)
END;
END LOOP;
RETURN o_str;
END;
/
Query 1:
SELECT numToEasternArabic( 1438 )
FROM DUAL
| NUMTOEASTERNARABIC(1438) |
|--------------------------|
| ١٤٣٨ |
Upvotes: 2