2013-07-12 55 views
0

我有變量lr_temp並且它是RAW(8)類型。製作RawToHex(lr_temp)我收到字符串:BDAB59967DF11ECC(以十六進制表示的8個字節)。我的問題是接受整數值的每個字節:Oracle 11g:將RAW(8)轉換爲整數範圍0..255的表格

dbms_output.put_line(RawToHex(lr_temp)); 
    FOR i IN 1 .. 8 
    LOOP 
    dbms_output.put_line(ascii(utl_raw.substr(lr_temp, i, 1))); 
    END LOOP; 

我收到:

BDAB59967DF11ECC 
66 
65 
53 
57 
55 
70 
49 
67 

BD18966AB171沒有65等..

回答

2
dbms_output.put_line(RawToHex(lr_temp)); 
    FOR i IN 1 .. lcn_data_length 
    LOOP 
    dbms_output.put_line(utl_raw.cast_to_binary_integer(utl_raw.substr(lr_temp, i, 1))); 
    END LOOP; 

和輸出:

BDAB59967DF11ECC 
189 
171 
89 
150 
125 
241 
30 
204