oracle的length()、lengthb()、to_single_bye()、instr()、translate()函数

1.length('张三')  结果:2

2.lengthb('张三')  结果:4

所以length返回长度为字符个数,lengthb返回长度为字节数

3.to_single_byte() :全角转半角函数

 4.instr()函数,返回参数2字符在参数1字符中的位置,注意位置从1开始,不存在返回0

  例如:instr('abc','a')  结果:1

     instr('abc','d')  结果:0

5.translate()函数,将参数1中的与参数2的字符匹配的字符串

  例如:需求:去掉字符串中的数字

        translate('a123b程54','0123456789',' ')    注意,最后引号中有一个空格

        

 

posted @ 2022-10-31 15:05  程长新  阅读(316)  评论(0)    收藏  举报