Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Numeric values of Kanji characters

Re: Numeric values of Kanji characters

From: <esiyuri_at_my-dejanews.com>
Date: Tue, 06 Oct 1998 15:26:05 GMT
Message-ID: <6vdcqc$rqt$1@nnrp1.dejanews.com>


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;

begin
  digit1 := translate(chr, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
                           '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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US