If the chr_code is smaller than or equal to 255, the returned 1 character string will be of type VARCHAR. Otherwise the returned type is NVARCHAR.
chr returns a new one character long string containing the character with character code given as parameter.
SQL> select chr (33); callret VARCHAR _______________________________________________________________________________ ! 1 Rows. -- 3 msec.
This stored procedure lists the ASCII values and characters in a string given as argument.
SQL> create procedure test_chr (in str varchar) { declare pos integer; pos := 0; declare c_code, c_code2 integer; declare c_char varchar; result_names (c_code, c_code2, c_char); while (pos < length (str)) { result (aref (str, pos), ascii (subseq (str, pos, pos+1, 1)), chr (aref (str, pos))); pos := pos + 1; } } ; Done. -- 7 msec. SQL> test_chr ('Nebuchadnessar'); c_code c_code2 c_char INTEGER NOT NULL INTEGER NOT NULL VARCHAR NOT NULL _______________________________________________________________________________ 78 78 N 101 101 e 98 98 b 117 117 u 99 99 c 104 104 h 97 97 a 100 100 d 110 110 n 101 101 e 115 115 s 115 115 s 97 97 a 114 114 r 14 Rows. -- 7 msec.