易截截图软件、单文件、免安装、纯绿色、仅160KB

Oracle 字符串长度函数


LENGTH calculates length using characters as defined by the input character set. 
LENGTHB uses bytes instead of characters. 
VSIZE returns the number of bytes in the internal representation of expr.
LENGTHC uses Unicode complete characters. 
LENGTH2 uses UCS2 codepoints. 
LENGTH4 uses UCS4 codepoints 
select length('adfad合理') "bytesLengthIs" from dual --7
select lengthb('adfad') "bytesLengthIs" from dual --5
select lengthb('adfad合理') "bytesLengthIs" from dual --11
select vsize('adfad合理') "bytesLengthIs" from dual --11
select lengthc('adfad合理')"bytesLengthIs" from dual --7
因此,在utf-8的字符集下
lengthb=vsize
lengthc=length
utf-8的中文字符占用3个字节,gbk的中文字符占用2个字节,iso-8859-1的中文字符被识别为占用2个字节,iso不支持中文字符的编码,应该是都当成某个拉丁字母了.Oracle没有关系,oracle只是负责存储数据.
可以先用 select * from v$nls_parameters 看看oracle的字符集


相关文档:

Oracle的Package的作用以及使用什么工具编写

1、Oracle的Package除了把存储过程放到一堆儿以外还有没有其他的作用(好处)?
2、如何把现有的存储过程加入到Package中?
3、除了使用SQL Plus,还有没有什么工具做Package?
4、使用SQL Plus编译Package,是否每次都是编译Package中所有的存储过程?
1、你不觉得把存储过程分门别类是很重要的么,而且不同的package的 ......

ORACLE函数大全

 
SQL中的单记录函数
1.ASCII
返回与指定的字符对应的十进制数;
SQL> select ascii('A') A,ascii('a') a,ascii('0') zero,ascii(' ') space from dual;
        A         A      ZERO  &nbs ......

oracle修改用户名

 --sqlplus
sqlplus;
sys /password as sysdba;
--查找用户ID(user#),数据库里面存放的用户都是大写!
select user#,name,password from user$ where name ='FACT';
USER# NAME                      ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号