【问题标题】:2000/100 , I want output 2000 (strings before /)2000/100 ,我想要输出 2000(/ 之前的字符串)
【发布时间】:2023-01-20 15:54:36
【问题描述】:

帮助获得输出为 2000,其中输入值为 2000/100

我想要整个字符串 /

input 2000/100
output 2000

【问题讨论】:

标签: sql oracle plsql


【解决方案1】:

两个简单的选项(根据您的描述):

SQL> with test (col) as
  2    (select '2000/100' from dual)
  3  select col,
  4    regexp_substr(col, 'w+')           option_1,
  5    substr(col, 1, instr(col, '/') - 1) option_2
  6  from test;

COL      OPTION_1 OPTION_2
-------- -------- --------
2000/100 2000     2000

SQL>

【讨论】:

    猜你喜欢
    • 2021-05-27
    • 1970-01-01
    • 2021-01-30
    • 1970-01-01
    • 2011-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多