hive instr 函数
2020-01-11 16:21
134 查看
instr(string str, string substr)
查找字符串str中子字符串substr出现的位置,如果查找失败将返回0,如果任一参数为Null将返回null,注意位置为从1开始的
示例:如果在一个表里面找出某些字段包含一些特殊字符的数据 如:
*
(
)
+
|
"
:
?
>
<
{
}
[
]
.
,
则代码如下
select cid, last_name, first_name from contact.t_customer_contact_list_total where day='2017-06-22' and ( instr(first_name,'*')>0 or instr(last_name,'*')>0 or instr(first_name,'(')>0 or instr(last_name,'(')>0 or instr(first_name,')')>0 or instr(last_name,')')>0 or instr(first_name,'_')>0 or instr(last_name,'_')>0 or instr(first_name,'+')>0 or instr(last_name,'+')>0 or instr(first_name,'"')>0 or instr(last_name,'"')>0 or instr(first_name,':')>0 or instr(last_name,':')>0 or instr(first_name,'?')>0 or instr(last_name,'?')>0 or instr(first_name,'>')>0 or instr(last_name,'>')>0 or instr(first_name,'<')>0 or instr(last_name,'<')>0 or instr(first_name,'{')>0 or instr(last_name,'{')>0 or instr(first_name,'}')>0 or instr(last_name,'}')>0 or instr(first_name,'[')>0 or instr(last_name,'[')>0 or instr(first_name,']')>0 or instr(last_name,']')>0 or instr(first_name,'.')>0 or instr(last_name,'.')>0 ) limit 10 ;
转载于:https://my.oschina.net/u/3455048/blog/1002238
- 点赞 1
- 收藏
- 分享
- 文章举报
相关文章推荐
- hive instr 函数
- Hive 函数小集合
- 利用instr()函数防止SQL注入攻击
- hive函数大全
- Hive常用字符串操作函数--笔记
- oracle函数INSTR用法
- 利用udf函数将Hive统计结果直接插入到MySQL
- hive三 常见运算符和函数
- Hive分析函数之grouping sets、cube、rollup学习
- hive的UDF 函数
- hive 的udf(user defined function)自定义函数
- Hive的自定义函数
- Hive 文件格式 & Hive操作(外部表、内部表、区、桶、视图、索引、join用法、内置操作符与函数、复合类型、用户自定义函数UDF、查询优化和权限控制)
- hive常用函数整理
- HiveSQL基础之窗口函数
- hive的常用函数
- hive函数参考手册
- Hive 内建操作符与函数开发
- [Hive]Hive使用指南六 日期相关函数
- Spark1.4.0-SparkSQL与Hive整合-支持窗口分析函数