oracle中vsize和length

來源:互聯網
上載者:User

標籤:tab   查看   ext   結果   size   a10   長度   div   比較   

其實LENGTH與VSIZE這兩個函數聯絡不大,區別很大。雖然都是“取長度”,但是LENGTH函數結果是“有多少個字元”,VSIZE結果是“需要多少bytes”。
簡單看一下這兩個函數。

1.建立表T並初始化三條資料

[email protected]>

create table t (x varchar2(10));
[email protected]> insert into t values (‘H‘);

[email protected]> insert into t values (‘侯‘);

[email protected]> insert into t values (‘H侯‘);

[email protected]> commit;

2.查看錶T中的資料
[email protected]> select * from t;
X

----------
H

H侯
3.比較LENGTH和VSIZE兩個函數的結果

[email protected]> col x for a10

[email protected]> col DUMP(X) for a30

[email protected]> select x, length(x), vsize(x), dump (x) from t;

X LENGTH(X) VSIZE(X) DUMP(X)

---------- ---------- ---------- ------------------------------
H 1 1 Typ=1 Len=1: 72
侯 1 3 Typ=1 Len=3: 228,190,175
H侯 2 4 Typ=1 Len=4: 72,228,190,175

4.結論

“H”包含1個字元,長度是1 byte;
“侯”包含1個字元,長度是3 bytes;
“H侯”包含2個字元,長度是4 bytes。


轉自 : https://zhidao.baidu.com/question/1177251446363924539.html

oracle中vsize和length

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.