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