GVKun编程网logo

Oracle regexp_like 得到错误的结果(oracle regexp_like用法)

1

如果您想了解Oracleregexp_like得到错误的结果的相关知识,那么本文是一篇不可错过的文章,我们将对oracleregexp_like用法进行全面详尽的解释,并且为您提供关于Fororacl

如果您想了解Oracle regexp_like 得到错误的结果的相关知识,那么本文是一篇不可错过的文章,我们将对oracle regexp_like用法进行全面详尽的解释,并且为您提供关于For oracle databases, if the top showing the oracle database, then oracle process is using the top c、Greenplum 中使用 regexp_like、Java中的排序算法问题;得到错误的结果、NodeJS-Oracle DB - NJS-040 连接超时,在 ICP 中使用带有 Lopback 的 oracle 驱动程序(loopback-connector-oracle)的有价值的信息。

本文目录一览:

Oracle regexp_like 得到错误的结果(oracle regexp_like用法)

Oracle regexp_like 得到错误的结果(oracle regexp_like用法)

如何解决Oracle regexp_like 得到错误的结果

我有这样的选择并且它工作正常:

  1. select * from printers where
  2. printer_id like ''XERX-15%'' Or printer_id like ''OFFJT-16%'' ;

我正在尝试将表达式转换为 regexp_like 因为我有很多这样的条件,

  1. select * from printers where
  2. regexp_like(printer_id,''XERX-15%|OFFJT-16%'')

似乎它给出了错误的结果......

  1. create table printers(printer_id varchar(50));
  2. insert into printers values(''XERX-1500'');
  3. insert into printers values(''XERX-1550'');
  4. insert into printers values(''XERX-1560'');
  5. insert into printers values(''XERX-1570'');
  6. insert into printers values(''XERX-1601'');
  7. insert into printers values(''XERX-1601'');
  8. insert into printers values(''XERX-1602'');
  9. insert into printers values(''XERX-1603'');
  10. insert into printers values(''OFFJT-1504'');
  11. insert into printers values(''OFFJT-1604'');

从打印机中选择 * printer_id like ''XERX-15%'' 或 printer_id like ''OFFJT-16%'' ;

从打印机中选择 * regexp_like(printer_id,''XERX-15%|OFFJT-16%'')

http://sqlfiddle.com/#!4/44c23

解决方法

% 不是正则表达式中的通配符。

你想要:

  1. select *
  2. from printers
  3. where regexp_like(printer_id,''^(XERX-15|OFFJT-16)'')
  • ^ 匹配字符串的开头然后
  • XERX-15OFFJT-16

如果您不想使用捕获组 () 那么您可以等效地使用:

  1. select *
  2. from printers
  3. where regexp_like(printer_id,''^XERX-15|^OFFJT-16'')
,

% 符号是一个 like 通配符。在您的正则表达式中,它是一个文字字符;所以删除它:

  1. regexp_like(printer_id,''XERX-15|OFFJT-16'')

或者只匹配行首(就像你原来的那样):

  1. regexp_like(printer_id,''^(XERX-15|OFFJT-16)'')

SQL fiddle

For oracle databases, if the top showing the oracle database, then oracle process is using the top c

For oracle databases, if the top showing the oracle database, then oracle process is using the top c

Note 805586.1 Troubleshooting Session Administration (Doc ID 805586.1) Note 822527.1 How To Find Where The Memory Is Growing For A Process (Doc ID 822527.1) Note 273646.1 How to diagnose the high cpu utilization of ORACLE.EXE in Windows environment Note 728539.1 Find Blocking Sessions In sqlPLUS Note 61552.1 Troubleshooting Oracle Database Hanging Issues for versions from 7 to 9--Exhaustive Note 164760.1 Detecting and Resolving Locking Conflicts using TopSessions

Greenplum 中使用 regexp_like

Greenplum 中使用 regexp_like

CREATE OR REPLACE FUNCTION regexp_like(str character, reg character)
  RETURNS boolean AS
$BODY$
declare
v_match  text;
begin
select regexp_matches(str,reg) into v_match;
if v_match is not NULL then
return true;
else
return false;
end if;
end;
$BODY$
  LANGUAGE plpgsql VOLATILE;
ALTER FUNCTION regexp_like(character, character)
  OWNER TO gpadmin;
测试:
--手机号码:
select regexp_like(''+8618618888888'',''^ *(\\+86)?1[3|4|5|8]{1}[0-9]{9} *$'');
---身份证号:
select regexp_like(''120225198700000000'',''^([0-9]{15}$|^[0-9]{18}$|^[0-9]{17}([0-9]|X|x))$'');
---座机号码:
select regexp_like(''022-29778888'',''^ *0[0-9]{2,3}-?[0-9]{7,8} *$'',''i'')

我们在 SQL 使用正则表达式进行格式校验,在 Orcle 中经常使用 regexp_like,Postgresql 中正则判断函数 regexp_matches 返回匹配的字符串,使用上有些不顺手,故改之


Java中的排序算法问题;得到错误的结果

Java中的排序算法问题;得到错误的结果

如何解决Java中的排序算法问题;得到错误的结果

在类MainProgram中创建一个名为indexOfSmallestFrom的类方法。它的工作方式与上一节中的方法类似,但仅考虑向前某个索引中的表值。除了表之外,它还接收此起始索引作为参数。

在此示例中,第一个方法调用从索引0开始搜索最小编号的索引。从索引0开始,最小数字为-1并且其索引为0。第二个方法调用搜索以下编号的索引从索引1开始的最小值。在这种情况下,最小数字为6,其索引为1。第三个调用从索引2开始搜索最小值的索引。然后,最小数字为8,索引为3。

应该为最小数组打印索引。 根据int数组,我的输出应为:

1
1
4

但是我得到了:

1
1
3

无法逻辑地找出原因。

public class MainProgram {

    public static void main(String[] args) {

        int[] array = {3,1,5,99,3,12};
        
        System.out.println(MainProgram.indexOfSmallestFrom(array,0));
        System.out.println(MainProgram.indexOfSmallestFrom(array,1));
        System.out.println(MainProgram.indexOfSmallestFrom(array,2));
    }
    
    public static int indexOfSmallestFrom(int[] table,int startIndex){
        int count = startIndex;
        int indexOf = 0;
        int smallest = table[startIndex];
        for(int i = startIndex; i < table.length; i++){
            if(smallest > table[i]){
               smallest = table[i];
               count++;
            }
              indexOf = count; 
        }
            return indexOf;
    }   
 
}

解决方法

当发现一个小于indexOf值的元素时,只需更新indexOf即可,该元素最初被初始化为startIndex。

遍历所有值后,返回最终更新的indexOf。

// "static void main" must be defined in a public class.
public class Main {
    public static void main(String[] args) {

        int[] array = {3,1,5,99,3,12};

        System.out.println(indexOfSmallestFrom(array,0));
        System.out.println(indexOfSmallestFrom(array,1));
        System.out.println(indexOfSmallestFrom(array,2));
    }

    public static int indexOfSmallestFrom(int[] table,int startIndex){
        int indexOf = startIndex;
        int smallest = table[startIndex];
        for(int i = startIndex; i < table.length; i++){
            if(smallest > table[i]){
               smallest = table[i];
               indexOf = i;
            }
        }
            return indexOf;
    }   
}

NodeJS-Oracle DB - NJS-040 连接超时,在 ICP 中使用带有 Lopback 的 oracle 驱动程序(loopback-connector-oracle)

NodeJS-Oracle DB - NJS-040 连接超时,在 ICP 中使用带有 Lopback 的 oracle 驱动程序(loopback-connector-oracle)

如何解决NodeJS-Oracle DB - NJS-040 连接超时,在 ICP 中使用带有 Lopback 的 oracle 驱动程序(loopback-connector-oracle)?

我正在使用 loopback-connector-oracle 4.1.1 版寻求有关我面临的问题的一些信息。分析如下: 我们有 DB 连接配置,可以使用 json 文件格式的 oracle 连接器使用属性连接到 oracle DB 数据源。 "maxConn": 20,“主机”:DB_HOST, “端口”:DB_PORT, “数据库”:DB_NAME, “密码”:DB_PASSWORD, “用户”:DB_USER, "connector": "oracle",

有两个进程/pod 正在运行,每个进程/pod 都有自己的池供oracle 连接器使用。发生的情况是,在一个实例中,oracle 能够连接并处理请求,但在第二个 pod/进程中,我注意到 njs-040 错误连接超时。由于两者都运行在同一个环境中,所以连接性不会成为问题。我正在寻求您的帮助或意见以了解连接池耗尽的原因?正如我所看到的,DB 上的连接/会话数量配置的数量较少。 当我重新启动 pod/进程时,一切都会恢复正常。在我的流程中遇到的一些问题,如果您可以指导并提供宝贵的意见,我正在寻求您的帮助。

  • 如果使用连接池(oracle 连接器),它也应该释放对象,耗尽的机会会减少吗?
  • 在进程/pod 启动并通过连接器 (oracle) 获取数据源中的连接对象后,发生网络问题并且进程和数据库之间的连接丢失,连接器是否恢复?根据我的观察,我在其他进程中注意到的似乎应该被恢复,当它与范围一起运行时,在一个进程中可能会导致什么?

我非常感谢您的回复。 提前致谢 桑吉夫

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

我们今天的关于Oracle regexp_like 得到错误的结果oracle regexp_like用法的分享就到这里,谢谢您的阅读,如果想了解更多关于For oracle databases, if the top showing the oracle database, then oracle process is using the top c、Greenplum 中使用 regexp_like、Java中的排序算法问题;得到错误的结果、NodeJS-Oracle DB - NJS-040 连接超时,在 ICP 中使用带有 Lopback 的 oracle 驱动程序(loopback-connector-oracle)的相关信息,可以在本站进行搜索。

本文标签: