我的应用程序创建了一些带有过度字段格式的记录。我需要识别在同一领域中具有大小写变化的记录。示例:字段名称:" AAA bbb ccc"或字段名称:" aaa BBB CCC"。有没有办法根据案例的字段值进行选择? 名称字段中的另一个特定情况:AAA Bbbb Cccc - >名字全部用大写字母,姓氏 - >首字母大写另一个小写字母
答案 0 :(得分:1)
使用foreach ($results['result'] as $item) {
echo $item['flightNumber'];
}
和upper
检查的简单方法。
lower
答案 1 :(得分:0)
您可以使用区分大小写的正则表达式来查找大写和小写字母:
where regexp_like(field, '([A-Z].*[a-z])|([a-z].*[A-Z])', 'c')
答案 2 :(得分:0)
据我所知,你想找到"重复"。怎么样?
SQL> with test (id, col) as
2 (select 1, 'AAA bbb CCC' from dual union
3 select 2, 'aaa bbb ccc' from dual union
4 select 3, 'xxx yyy zzz' from dual
5 )
6 select *
7 from test
8 where upper(col) in (select upper(col)
9 from test
10 group by upper(col)
11 having count(*) > 1);
ID COL
---------- -----------
2 aaa bbb ccc
1 AAA bbb CCC
SQL>
答案 3 :(得分:0)
试试这个,
select *
from (with test (id, col) as
(select 1, 'AAA bbb CCC' from dual union
select 2, 'Aaa Bbb Ccc' from dual union
select 3, 'xxx yyy zzz' from dual union
select 2, 'aaa bbb ccC' from dual)
select id, col, initcap(col) correct_format
from test)
where col != correct_format;
或者您也不能将其放在子查询中
with test (id, col) as
(select 1, 'AAA bbb CCC' from dual union
select 2, 'Aaa Bbb Ccc' from dual union
select 3, 'xxx yyy zzz' from dual union
select 2, 'aaa bbb ccC' from dual)
select id, col, initcap(col) correct_format
from test
where col != initcap(col);