How to find character code in PL / SQL?

I want to find the character code of a specific character in a string. For example, if I have a string

"Hello"

How to find the character code for all or specific characters in a string.

I see that PL / SQL has functions ASCII()and ASCIISTR(), but I could not find any character related functions.

+3
source share
2 answers
  create or replace function asciistr2(s IN varchar2)
  RETURN varchar2
  IS
    result varchar2(32767) := '';
  BEGIN
    FOR i IN 1..Length(s)
      LOOP
      dbms_output.put_line(ASCII(substr(s,i,1)));
      result := result || ASCII(substr(s,i,1));
      END LOOP;
      return result;
  END;


  Select asciistr2('HELLO') from dual

Result: 7269767679

DBMS_OUTPUT

 72
 69
 76
 76
 79
+4
source

What exactly do you expect? Looking at your question, it seems to me that it ASCII()will provide you with what you need, see this ASCII tutorial . You can do a loop

Or do you mean the meaning of Unicode?

+1
source

Source: https://habr.com/ru/post/1760692/


All Articles