【问题标题】:regexp_substr equivalent in postgresqlpostgresql 中的 regexp_substr 等效项
【发布时间】:2022-01-17 07:11:17
【问题描述】:

我在 oracle PLSQL 中有这段代码:

select * from con_transaccioncabecera c
where c.cab_estadocon in
(select regexp_substr('S-C-I-A','[^-]+',1,level) from dual
connect by regexp_substr('S-C-I-A','[^-]+',1,level) is not NULL)

我输入了字符串“S-C-I-A”,但实际上,会有一个变量。

我需要 plpgsql 中的等价物。

【问题讨论】:

    标签: sql postgresql


    【解决方案1】:

    这在 Postgres 中要容易得多(不需要 PL/pgSQL)

    select * 
    from con_transaccioncabecera c
    where c.cab_estadocon = any (string_to_array('S-C-I-A','-'))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-22
      • 1970-01-01
      • 1970-01-01
      • 2019-11-11
      • 2013-05-03
      • 2013-01-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多