今天在用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