【问题标题】:Oracle one column contains the other columnOracle 一列包含另一列
【发布时间】:2018-07-19 21:37:09
【问题描述】:
ID  - FILE_NAME
100   SOMETHING_100.TXT

这个问题其实很简单。我想在另一个列字符串中选择包含自己的 ID 的行

有什么想法吗?

【问题讨论】:

  • 使用where file_name like '%'||id||'%'

标签: oracle contains


【解决方案1】:

INSTR 可能会有所帮助;例如,

select *
from your_table
where instr(file_name, id) > 0;

如果 ID 是数字(看起来像),则添加 TO_CHAR:

where instr(file_name, to_char(id)) > 0

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-15
    • 2020-12-14
    • 1970-01-01
    • 2012-05-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多