oracle的nvarchar2類型詭異問題

今天在用oracle substr截取字符串時出現問題,具體以下:oracle

1>select substr(password,1,2) from user where code='xxxxx' (password的值爲'123456') 結果:1code

2>select substr('123456',1,2) from user where code='xxxxx' 結果:12字符串

一陣搗鼓,才知道是nvarchar2的問題,nvarchar2列類型下,對於數字和字母都要佔用兩個字節,這一點比較特殊。select

相關文章
相關標籤/搜索