Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / PL SQL Data Types
 

Useful character built-in functions

CHR and ASCII are opposites. CHR(code) returns a character from the current character set identified by its binary equivalent. ASCII (character) returns the binary equivalent of the character passed into the function. SQL> SQL> declare   2      v_nr number;   3      v_tx char(1);   4  begin   5      v_nr:=ascii('A');   6      DBMS_OUTPUT.put_line(v_nr);   7      v_tx:=chr(v_nr);   8      DBMS_OUTPUT.put_line(v_tx);   9  end;  10  / 65 A PL/SQL procedure successfully completed.