Friday, 3 February 2012

ASCII table listing from SQL

Today I was chasing the relevant ASCII code for certain characters... I know there are plenty of ASCII tables on the net, but this is an interesting SQL solution, nonetheless.
select rownum "dec"
      ,chr(rownum) "char"
      ,to_char(rownum,'XXXX') "hex"
from dual connect by level < 256;
dec char    hex    
--- ----    ---
1       1
2       2
3       3
4       4
5       5
6       6
7       7
8       8
9 " "   9
10 "
"     A
11       B
12       C
13 "
"     D
14       E
15       F
16      10
17      11
18      12
19      13
20      14
21      15
22      16
23      17
24      18
25      19
26      1A
27      1B
28      1C
29      1D
30      1E
31      1F
32      20
33 !    21
34 "    22
35 #    23
36 $    24
37 %    25
38 &    26
39 '    27
40 (    28
41 )    29
42 *    2A
43 +    2B
44 ,    2C
45 -    2D
46 .    2E
47 /    2F
48 0    30
49 1    31
50 2    32
51 3    33
52 4    34
53 5    35
54 6    36
55 7    37
56 8    38
57 9    39
58 :    3A
59 ;    3B
60 <    3C
61 =    3D
62 >    3E
63 ?    3F
64 @    40
65 A    41
66 B    42
67 C    43
68 D    44
69 E    45
70 F    46
71 G    47
72 H    48
73 I    49
74 J    4A
75 K    4B
76 L    4C
77 M    4D
78 N    4E
79 O    4F
80 P    50
81 Q    51
82 R    52
83 S    53
84 T    54
85 U    55
86 V    56
87 W    57
88 X    58
89 Y    59
90 Z    5A
91 [    5B
92 \    5C
93 ]    5D
94 ^    5E
95 _    5F
96 `    60
97 a    61
98 b    62
99 c    63
100 d    64
101 e    65
102 f    66
103 g    67
104 h    68
105 i    69
106 j    6A
107 k    6B
108 l    6C
109 m    6D
110 n    6E
111 o    6F
112 p    70
113 q    71
114 r    72
115 s    73
116 t    74
117 u    75
118 v    76
119 w    77
120 x    78
121 y    79
122 z    7A
123 {    7B
124 |    7C
125 }    7D
126 ~    7E
127     7F
128 €    80
129     81
130 ‚    82
131 ƒ    83
132 „    84
133 …    85
134 †    86
135 ‡    87
136 ˆ    88
137 ‰    89
138 Š    8A
139 ‹    8B
140 Œ    8C
141     8D
142 Ž    8E
143     8F
144     90
145 ‘    91
146 ’    92
147 “    93
148 ”    94
149 •    95
150 –    96
151 —    97
152 ˜    98
153 ™    99
154 š    9A
155 ›    9B
156 œ    9C
157     9D
158 ž    9E
159 Ÿ    9F
160      A0
161 ¡    A1
162 ¢    A2
163 £    A3
164 ¤    A4
165 ¥    A5
166 ¦    A6
167 §    A7
168 ¨    A8
169 ©    A9
170 ª    AA
171 «    AB
172 ¬    AC
173 ­    AD
174 ®    AE
175 ¯    AF
176 °    B0
177 ±    B1
178 ²    B2
179 ³    B3
180 ´    B4
181 µ    B5
182 ¶    B6
183 ·    B7
184 ¸    B8
185 ¹    B9
186 º    BA
187 »    BB
188 ¼    BC
189 ½    BD
190 ¾    BE
191 ¿    BF
192 À    C0
193 Á    C1
194 Â    C2
195 Ã    C3
196 Ä    C4
197 Å    C5
198 Æ    C6
199 Ç    C7
200 È    C8
201 É    C9
202 Ê    CA
203 Ë    CB
204 Ì    CC
205 Í    CD
206 Î    CE
207 Ï    CF
208 Ð    D0
209 Ñ    D1
210 Ò    D2
211 Ó    D3
212 Ô    D4
213 Õ    D5
214 Ö    D6
215 ×    D7
216 Ø    D8
217 Ù    D9
218 Ú    DA
219 Û    DB
220 Ü    DC
221 Ý    DD
222 Þ    DE
223 ß    DF
224 à    E0
225 á    E1
226 â    E2
227 ã    E3
228 ä    E4
229 å    E5
230 æ    E6
231 ç    E7
232 è    E8
233 é    E9
234 ê    EA
235 ë    EB
236 ì    EC
237 í    ED
238 î    EE
239 ï    EF
240 ð    F0
241 ñ    F1
242 ò    F2
243 ó    F3
244 ô    F4
245 õ    F5
246 ö    F6
247 ÷    F7
248 ø    F8
249 ù    F9
250 ú    FA
251 û    FB
252 ü    FC
253 ý    FD
254 þ    FE
255 ÿ    FF
I think I'm glad I don't need to work in a multi-language / character set environment.

No comments: