[20211110]oracle數字編碼30.txt

lfree發表於2021-11-11

[20211110]oracle數字編碼30.txt

--//連結http://www.itpub.net/thread-2144556-1-1.html,出現數字編碼30的問題,理論講不可能出現這樣的編碼。
--//以前也遇到類似的問題。http://www.itpub.net/thread-2095697-1-1.html
--//自己在測試環境模擬看看。

1.環境:
SCOTT@book> @ ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

2.測試:
create table t ( x number);
insert into t values (0);
insert into t values (1);
insert into t values (2);
insert into t values (0);
commit ;

SCOTT@book> select rowid,t.* from t ;
ROWID                    X
------------------ -------
AABQdgAAEAAAALDAAA       0
AABQdgAAEAAAALDAAB       1
AABQdgAAEAAAALDAAC       2
AABQdgAAEAAAALDAAD       0

SCOTT@book> @ rowid AABQdgAAEAAAALDAAA
    OBJECT       FILE      BLOCK        ROW ROWID_DBA            DBA                  TEXT
---------- ---------- ---------- ---------- -------------------- -------------------- ----------------------------------------
    329568          4        707          0  0x10002C3           4,707                alter system dump datafile 4 block 707 ;

BBED> x /rx *kdbr[3]
rowdata[0]                                  @8166
----------
flag@8166: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8167: 0x02
cols@8168:    1

col    0[1] @8169:  0x80

BBED> assign offset 8170=0x30;
ub1 rowdata[0]                              @8170     0x30
--//注意偏移要加1,前面1位是長度指示器。

BBED> sum apply
Check value for File 4, Block 707:
current = 0xb731, required = 0xb731

BBED> x /rx *kdbr[3]
rowdata[0]                                  @8166
----------
flag@8166: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8167: 0x02
cols@8168:    1

col    0[1] @8169:  0x30

3.在sqlplus下執行:
SCOTT@book> select rowid,dump(x) c30 ,x from t ;
ROWID              C30                                      X
------------------ ------------------------------ -----------
AABQdgAAEAAAALDAAA Typ=2 Len=1: 128                         0
AABQdgAAEAAAALDAAB Typ=2 Len=2: 193,2                       1
AABQdgAAEAAAALDAAC Typ=2 Len=2: 193,3                       2
AABQdgAAEAAAALDAAD Typ=2 Len=1: 48                ###########

--//在toad下執行報如下錯誤。
OCI-22065: number to text translation for the given format causes overflow



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2841659/,如需轉載,請註明出處,否則將追究法律責任。

相關文章