ASCII

From Oracle FAQ
⧼orafaq-jumptonavigation⧽⧼orafaq-jumptosearch⧽

ASCII (American Standard Code for Information Interchange) is used extensively in data transmission. The ASCII character set includes 128 upper and lower case letters, numerals and special purpose symbols, each encoded by a unique 7-bit binary number.

Convert ASCII to characters

Print ASCII code for a character:

SQL> SELECT ascii('A') FROM dual;
ASCII('A')
----------
        65

Convert characters to ASCII codes

Print the character for a given ASCII code:

SQL> SELECT chr(65) FROM dual;
C
-
A

ASCII table

Here is a small PL/SQL program that can be used to print an ASCII table:

set serveroutput on size 10240
declare
   i number;
   j number;
   k number;
begin
   for i in 2..15 loop
       for j in 1..16 loop
           k:=i*16+j;
           dbms_output.put((to_char(k,'000'))||':'||chr(k)||'  ');
           if k mod 8 = 0 then
              dbms_output.put_line();
           end if;
       end loop;
   end loop;
end;
/

Also see

Glossary of Terms
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #