The query below generated the data shown in the table using the DUMP statement. SQL*Plus dumped in a straight line as normal. I used Google Docs to format it into a table.
| | | | | | | | | | | | | | | | | | | | . | Char | Ascii Decimal | Octal | Hex | | Char | Ascii Decimal | Octal | Hex | | Char | Ascii Decimal | Octal | Hex | | Char | Ascii Decimal | Octal | Hex | . | space | 32 | 40 | 20 | | 0 | 48 | 60 | 30 | | A | 65 | 101 | 41 | | a | 97 | 141 | 61 | . | ! | 33 | 41 | 21 | | 1 | 49 | 61 | 31 | | B | 66 | 102 | 42 | | b | 98 | 142 | 62 | . | " | 34 | 42 | 22 | | 2 | 50 | 62 | 32 | | C | 67 | 103 | 43 | | c | 99 | 143 | 63 | . | $ | 36 | 44 | 24 | | 3 | 51 | 63 | 33 | | D | 68 | 104 | 44 | | d | 100 | 144 | 64 | . | % | 37 | 45 | 25 | | 4 | 52 | 64 | 34 | | E | 69 | 105 | 45 | | e | 101 | 145 | 65 | . | & | 38 | 46 | 26 | | 5 | 53 | 65 | 35 | | F | 70 | 106 | 46 | | f | 102 | 146 | 66 | . | ' | 39 | 47 | 27 | | 6 | 54 | 66 | 36 | | G | 71 | 107 | 47 | | g | 103 | 147 | 67 | . | ( | 40 | 50 | 28 | | 7 | 55 | 67 | 37 | | H | 72 | 110 | 48 | | h | 104 | 150 | 68 | . | ) | 41 | 51 | 29 | | 8 | 56 | 70 | 38 | | I | 73 | 111 | 49 | | i | 105 | 151 | 69 | . | * | 42 | 52 | 2a | | 9 | 57 | 71 | 39 | | J | 74 | 112 | 4a | | j | 106 | 152 | 6a | . | + | 43 | 53 | 2b | | | | | | | K | 75 | 113 | 4b | | k | 107 | 153 | 6b | . | , | 44 | 54 | 2c | | [ | 91 | 133 | 5b | | L | 76 | 114 | 4c | | l | 108 | 154 | 6c | . | - | 45 | 55 | 2d | | \ | 92 | 134 | 5c | | M | 77 | 115 | 4d | | m | 109 | 155 | 6d | . | . | 46 | 56 | 2e | | ] | 93 | 135 | 5d | | N | 78 | 116 | 4e | | n | 110 | 156 | 6e | . | / | 47 | 57 | 2f | | ^ | 94 | 136 | 5e | | O | 79 | 117 | 4f | | o | 111 | 157 | 6f | . | | | | | | _ | 95 | 137 | 5f | | P | 80 | 120 | 50 | | p | 112 | 160 | 70 | . | : | 58 | 72 | 3a | | ` | 96 | 140 | 60 | | Q | 81 | 121 | 51 | | q | 113 | 161 | 71 | . | ; | 59 | 73 | 3b | | | | | | | R | 82 | 122 | 52 | | r | 114 | 162 | 72 | . | < | 60 | 74 | 3c | | { | 123 | 173 | 7b | | S | 83 | 123 | 53 | | s | 115 | 163 | 73 |
|
| | | | | | | | | | | | | | | | | | | | . | = | 61 | 75 | 3d | | | | 124 | 174 | 7c | | T | 84 | 124 | 54 | | t | 116 | 164 | 74 | . | > | 62 | 76 | 3e | | } | 125 | 175 | 7d | | U | 85 | 125 | 55 | | u | 117 | 165 | 75 | . | ? | 63 | 77 | 3f | | | | | | | V | 86 | 126 | 56 | | v | 118 | 166 | 76 | . | @ | 64 | 100 | 40 | | | | | | | W | 87 | 127 | 57 | | w | 119 | 167 | 77 | . | | | | | | | | | | | X | 88 | 130 | 58 | | x | 120 | 170 | 78 | . | | | | | | | | | | | Y | 89 | 131 | 59 | | y | 121 | 171 | 79 | . | | | | | | | | | | | Z | 90 | 132 | 5a | | z | 122 | 172 | 7a |
|
rem +--------------------------------------------------------------------------+
rem | Script ID: Dump.sql
rem | Purpose: Show how dump works and dump all characters in all sets.
rem |
rem | Developer: Lynn Tobias
rem | Script Date: 8/26/2008
rem | Oracle Ver: 10g
rem +--------------------------------------------------------------------------+
Set Serveroutput On
Declare
V_Outputstr Varchar2(50) ;
Begin
Dbms_Output.Put_Line(Rpad('Char',5)|| Rpad('Ascii',6)|| 'Octal Decimal Hex');
For V_Ctr In 1..94 Loop
Select Lpad(Substr(Dump(Substr(Charx,V_Ctr,1),17),Instr(Dump(Substr(Charx,V_Ctr,1),17),': ',11)+2),4) ||
Lpad(Substr(Dump(Substr(Charx,V_Ctr,1), 3),Instr(Dump(Substr(Charx,V_Ctr,1), 3),': ',11)+2),5) ||
Lpad(Substr(Dump(Substr(Charx,V_Ctr,1), 8),Instr(Dump(Substr(Charx,V_Ctr,1), 8),': ',11)+2),6) ||
Lpad(Substr(Dump(Substr(Charx,V_Ctr,1),10),Instr(Dump(Substr(Charx,V_Ctr,1),10),': ',11)+2),8) ||
Lpad(Substr(Dump(Substr(Charx,V_Ctr,1),16),Instr(Dump(Substr(Charx,V_Ctr,1),16),': ',11)+2),4)
Into V_Outputstr
From ( ------------- This is the list of characters we want to evaluate -------------------------
Select
' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
As Charx
From Dual
);
Dbms_Output.Put_Line(V_Outputstr);
End Loop;
End;
/
-- How the lines starting with LPad work:
-- 1 Substr(Charx,V_Ctr,1) get one character at a time from the string based on the counter
-- 2 Dump(Substr(Charx,V_Ctr,1),10) dump to get this string: 'Typ=1 Len=1: 97'
-- 3 Instr(Dump(Substr(Charx,V_Ctr,1),10),':',11) find the position of the ':' in the string
-- 4 Instr(Dump(Substr(Charx,V_Ctr,1),10),':',11)+2 Add 2 to get the beginning position of the character (i.e., 97)
-- 5 Substr (Search Item 2 ,Starting at position calculated in Item 4)
-- 6 LPad it so different length characters line up.
No comments:
Post a Comment