首页 > 数据库技术 > 详细

Oracle PLSQL Demo - 22.查看字符串的长度[lengthb, length],判断字符串是否包含中文

时间:2015-06-29 23:59:48      阅读:675      评论:0      收藏:0      [点我收藏+]
--Count the length of string
select lengthb(select * from scott.emp) as countted_by_byte, length(select * from scott.emp) as countted_by_char from dual;

--For some character encoding, the length() and the lengthb() is same in english
--you may use this feature to check whether the string constains the chinese char
declare 
  v_char varchar2(50) := hello world你好;
begin
  
  if lengthb(v_char) = length(v_char) then
    dbms_output.put_line(it have not chinese...);
  else 
    dbms_output.put_line(it have chinese...);
  end if;
  
end;

 

Oracle PLSQL Demo - 22.查看字符串的长度[lengthb, length],判断字符串是否包含中文

原文:http://www.cnblogs.com/nick-huang/p/4609118.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!