oracle中一个字符串包含另一个字符串中的所有字符

--解决监理报告中所勾选的标段信息,与该用户所管理的标段字符串不匹配的问题。

select * from a where instr(a,b)>0;
这个只能实现B字段是A字段中的某一部分的时候,
如果想要不论顺序或者不相邻的字符时,定义函数可以实现
 create or replace function checks(v_a varchar2,v_b varchar)
 return number
 as
    num number;
    cou number;
 begin
    num := -1;
    cou:=0;
    for i in 1..length(v_b) loop
       if instr(v_a,substr(v_b,i,1))>0 then
    cou:=cou+1;
       end if;
    end loop;
    if cou=length(v_b) then
    return cou;
    end if;
    dbms_output.put_line(cou||'    '||length(v_b));
 return num;
 end;

结果:
SQL> select * from a;

A          B
---------- ----------
asdf       sd
asdf       ad
asdf       df
asdf       asdf

asdf       ac

SQL> select * from a where checks(a,b)>0;

A          B
---------- ----------
asdf       sd
asdf       ad
asdf       df
asdf       asdf

oracle中一个字符串包含另一个字符串中的所有字符的更多相关文章

  1. js中如何判断一个字符串包含另外一个字符串?

    js中判断一个字符串包含另外一个字符串的方式比较多? 比如indexOf()方法,注意O是大写. var test="this is a test"; if(test.indexO ...

  2. lua判断字符串包含另一个字符串

    lua判断字符串包含另一个字符串 --string.find("元字符串","模式字符串") 如下: print(string.find("CCBWe ...

  3. Oracle 查询字段不包含多个字符串方法

    开发过程中遇到个需求,用户要提取的数据列中不包含 YF.ZF.JD的字符串, 方法1:select * from table  where  order_no not like '%YF%' and ...

  4. 二分法:从一个只包含数字的list中查找某个数

    #!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2017/4/10 19:03 # @Author : MnCu # @Site : # ...

  5. 将字符串存储到注册表中,长度一定是 strlen(text) + 1

    参考:https://docs.microsoft.com/en-us/windows/desktop/sysinfo/registry-value-types 将字符串存储到注册表中,长度参数一定要 ...

  6. Android一个工程引用另一个工程的方法

    一个工程包含另一个工程.相当于一个jar包的引用.但又不是jar包反而像个package 现在已经有了一个Android工程A.我们想扩展A的功能,但是不想在A的基础上做开发,于是新建了另外一个And ...

  7. 在SQLSERVER中如何检测一个字符串中是否包含另一个字符串

    --当charindex返回值大于0时则包含 为0不包含 select CHARINDEX('456','123456')   SQL语句使用CHARINDEX函数,来测试一个字符串中是否包含另一个字 ...

  8. php字符串查找函数 php查找字符串中出现的次数函数substr_count,判断字符串中是否包含另一个字符串函数strpos

    php字符串查找函数 php查找字符串中出现的次数函数substr_count,判断字符串中是否包含另一个字符串函数strpossubstr_count($haystack, $needle [,$o ...

  9. 在sql server中如何检测一个字符串中是否包含另一个字符串

    select CHARINDEX('456','123456')   SQL语句使用CHARINDEX函数,来测试一个字符串中是否包含另一个字符串中的方法: 一.CHARINDEX函数介绍 1.函数功 ...

随机推荐

  1. 在CentOS 7 上安装广告服务器 Revive Adserver

    导读 Revive Adserver是一个自由开源的广告管理系统,能使出版商,广告平台和广告商在网页.应用.视频上投放并管理广告的系统.Revive Adserver以前叫做OpenX Source, ...

  2. div排序 根据《input》

    jquery代码如下$(function(){//alert($("input").length); var arr=Array(); $("input").e ...

  3. 2016-2017 ACM-ICPC, NEERC, Southern Subregional Contest (Online Mirror, ACM-ICPC Rules, Teams Preferred) G 优先队列

    G. Car Repair Shop time limit per test 2 seconds memory limit per test 512 megabytes input standard ...

  4. 2015GitWebRTC编译实录3

    2015.05.17 librtprtcp 编译通过[702/1600 ] CXX obj /webrtc/modules/rtp_rtcp/source/rtp_rtcp.bitrate.o[703 ...

  5. HTTP详解(2)

    HTTP详解(2)-请求.响应.缓存 分类: 网络知识2013-03-17 16:45 1969人阅读 评论(0) 收藏 举报   目录(?)[+]   1. HTTP请求格式 做过Socket编程的 ...

  6. MySQL备份的shell脚本

    经过测试该脚本可以远程备份,但需要配置远程登录用户的权限,经过测试啊,在把这个脚本添加到计划任务的时候是无法识别mysql命令的(即使是将mysql添加到环境变量也无法识别,是因为/etc/cront ...

  7. 用类求圆面积c++

    #include<iostream>.#include<math.h>using namespace std;class Circle{    public:        d ...

  8. Linux驱动设计—— 中断与时钟@request_irq参数详解

    request_irq函数定义 /*include <linux/interrupt.h>*/ int request_irq(unsigned int irq, irq_handler_ ...

  9. Questions that are independent of programming language. These questions are typically more abstract than other categories.

    Questions that are independent of programming language.  These questions are typically more abstract ...

  10. java performance

    http://www.oracle.com/technetwork/java/performance-138178.html# http://www.oracle.com/technetwork/ja ...