环境:oracle 11.1.0.6.0
区别:length计算字符长度,lengthb计算字节长度。
SQL> select length('a') from dual; LENGTH('A') ----------- 1 SQL> select lengthb('a') from dual; LENGTHB('A') ------------ 1 SQL> select length('A') from dual; LENGTH('A') ----------- 1 SQL> select lengthb('A') from dual; LENGTHB('A') ------------ 1 SQL> select length('你好') from dual; LENGTH('你好') -------------- 2 SQL> select lengthb('你好') from dual; LENGTHB('你好') --------------- 4