I want to find character code of particular character in string. For instance if I have a string
"Hello"
How do i find the character code of all or particular characters in the string.
I see that PL/SQL has a ASCII()
and ASCIISTR()
functions but I could not find any character related functions.
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
What exactly would you expect? Looking at your question, it seems to me that ASCII()
would give you what you need, see this ASCII tutorial . You can loop
Or are you referring to the Unicode value?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.