Code ASCII for Oracle [message #616229] |
Fri, 13 June 2014 15:13 |
|
vantran
Messages: 11 Registered: April 2012 Location: CANADA, MONTREAL
|
Junior Member |
|
|
Hi,
I would like to know the code ASCII for the caracter like: '•' for database Oracle (Oracle Form).
Thanks for your answer.
|
|
|
|
|
|
|
|
Re: Code ASCII for Oracle [message #616434 is a reply to message #616417] |
Mon, 16 June 2014 18:55 |
|
Barbara Boehmer
Messages: 9103 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
Try copying and pasting the following into a .sql file:
SELECT ASCII ('•') FROM DUAL;
Then, from SQL*Plus, spool to a text file, run the .sql file that you stored the above in, spool off, then edit the text file that you spooled to and see what you get.
You can similarly run something like either of the following on your system to see what various values you get. You may find that you get different results in the SQL*Plus window than when you store the code to a .sql file and spool the results to a text file. I displayed only ASCII values 0 to 127, but you can change the numbers for any range that you want. You can generally find charts on the internet for those values that seem to be consistent everywhere, but the multi-byte characters seem to vary quite a bit. A lot of times there are problems with display between systems. For example, a lot of the codes between 0 and 32 on my system apparently may not display properly on this forum.
-- using SQL:
SCOTT@orcl12c> SELECT ROWNUM - 1 AS ascii,
2 CHR(ROWNUM - 1) AS character
3 FROM DUAL
4 CONNECT BY LEVEL <= 128
5 /
ASCII CHAR
---------- ----
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 !
34 "
35 #
36 $
37 %
38 &
39 '
40 (
41 )
42 *
43 +
44 ,
45 -
46 .
47 /
48 0
49 1
50 2
51 3
52 4
53 5
54 6
55 7
56 8
57 9
58 :
59 ;
60 <
61 =
62 >
63 ?
64 @
65 A
66 B
67 C
68 D
69 E
70 F
71 G
72 H
73 I
74 J
75 K
76 L
77 M
78 N
79 O
80 P
81 Q
82 R
83 S
84 T
85 U
86 V
87 W
88 X
89 Y
90 Z
91 [
92 \
93 ]
94 ^
95 _
96 `
97 a
98 b
99 c
100 d
101 e
102 f
103 g
104 h
105 i
106 j
107 k
108 l
109 m
110 n
111 o
112 p
113 q
114 r
115 s
116 t
117 u
118 v
119 w
120 x
121 y
122 z
123 {
124 |
125 }
126 ~
127
128 rows selected.
-- using PL/SQL:
SCOTT@orcl12c> SET SERVEROUTPUT ON FORMAT WRAPPED
SCOTT@orcl12c> BEGIN
2 DBMS_OUTPUT.PUT_LINE (' ASCII CHAR');
3 DBMS_OUTPUT.PUT_LINE ('---------- ----');
4 FOR i IN 0..127 LOOP
5 BEGIN
6 DBMS_OUTPUT.PUT_LINE (RPAD (i, 10) || CHR(i));
7 END;
8 END LOOP;
9 END;
10 /
ASCII CHAR
---------- ----
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 !
34 "
35 #
36 $
37 %
38 &
39 '
40 (
41 )
42 *
43 +
44 ,
45 -
46 .
47 /
48 0
49 1
50 2
51 3
52 4
53 5
54 6
55 7
56 8
57 9
58 :
59 ;
60 <
61 =
62 >
63 ?
64 @
65 A
66 B
67 C
68 D
69 E
70 F
71 G
72 H
73 I
74 J
75 K
76 L
77 M
78 N
79 O
80 P
81 Q
82 R
83 S
84 T
85 U
86 V
87 W
88 X
89 Y
90 Z
91 [
92 \
93 ]
94 ^
95 _
96 `
97 a
98 b
99 c
100 d
101 e
102 f
103 g
104 h
105 i
106 j
107 k
108 l
109 m
110 n
111 o
112 p
113 q
114 r
115 s
116 t
117 u
118 v
119 w
120 x
121 y
122 z
123 {
124 |
125 }
126 ~
127
PL/SQL procedure successfully completed.
|
|
|
|
Re: Code ASCII for Oracle [message #616523 is a reply to message #616498] |
Tue, 17 June 2014 18:18 |
|
Barbara Boehmer
Messages: 9103 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
The first ASCII codes 0-127 are fairly standard on most systems, as far as I know. Beyond that, there seems to be a variety of different codes on different operating systems and databases and tools using various character systems. You may get different results in a SQL*Plus Window, a SQL Developer Window, or when you spool to a text file, depending on various settings within your operating system and database and tool or editor. There may also be some duplication. That is why it is best to copy and paste questionable characters and use the ASCII function if you need to know the numeric value and run a list using CHR if you want to see a list of ASCII values and corresponding characters on your system. When whatever you are using to display the value cannot do so, because of a difference in character sets, then it displays some sort of substitution character, most commonly a question mark.
|
|
|