pgSQL中position函数的用法实现包含关系

函数用法:POSITION(substring in string)
substring参数是您要查找的字符串
POSITION()函数返回一个整数。该整数表示子字符串在字符串中的位置。如果在字符串中未找到子字符
串,则POSITION()函数将返回零(0),否则返回子字符串在字符串中的下标,测,1select
position('warning' in 'warning,handle,cases,caseinfo'),运行后返回1,测,2select position('handle'
in 'warning,handle,cases,caseinfo'),运行后返回9,即handle在字符串中的位置下标为9。如果子字符
串或字符串参数为null,则返回null
例如:position('warning' in 'warning,handle,cases,caseinfo')>0
warning,handle,cases,caseinfo中找warning的位置,如果大于0,则表示存在,否则不存在。

文章来源:https://blog.csdn.net/weixin_43230284/article/details/123271686

posted @   Lafite-1820  阅读(414)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
点击右上角即可分享
微信分享提示