Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Numeric values of Kanji characters
Mike,
> I have a stored procedure which uses the chr() function to convert varchar2
> strings to numeric values for indexing purposes.
>
> Sadly, the procedure fails when operating on Kanji characters. Can anyone
> tell me the lower and upper bounds returned by the chr() function on Kanji
> text?
As I understand it, chr() returns the character that corresponds to the given (numeric) value, not the other way around. If you want to do your own sort of indexing which requires converting a character string to a number I have used the following sort of code in the past... it would need to be changed for Kanji text.
declare
chr varchar2(1) := upper('&chr');
digit1 number; digit2 number; num number;
'00000000011111111112222222'); digit2 := translate(chr, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '12345678901234567890123456');
num := to_number(digit1 || digit2);
dbms_output.put_line('num='||to_char(num));
end;
/
I hope this helps.
--
Regards
Yuri McPhedran
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Tue Oct 06 1998 - 10:26:05 CDT