1。一般写法 select * from your_table t where length(t.name)> 4 and t.name not like '%c%'and t.name not like '%C%' and t.name not like '%+%'; 2。正则写法 select * from your_table t where length(t.name)> 4 and not regexp_like(name, '[cC+]');另这个问题不像是真正应用中的问题。
还是用not like 用正则好像是索引失效
select * from table where length(translate(col,'c+'||col,'c+'))=length(col)
select * from your_table t where length(t.name)> 4
and t.name not like '%c%'and t.name not like '%C%'
and t.name not like '%+%';
2。正则写法
select * from your_table t where length(t.name)> 4
and not regexp_like(name, '[cC+]');另这个问题不像是真正应用中的问题。
字母占一个字节 汉字占两个字节把
select lengthb('nihao')as l1,lengthb('你好')as l2 from dual
结果是 5 4
如果编码是GBK的,就占2个字节 ; 是UTF8的,就占3个字节,自己去DB查下就好了
SELECT *
FROM v$nls_parameters
WHERE parameter = 'NLS_CHARACTERSET';
关于字符集的问题 确实是 我的数据库中是gbk的
想改为utf-8测试一下的 但是一直没改成
有谁会写吗? 谢谢大家。