oracle - 如何在 oracle 查询中获取字符串的第一行?
问题描述
到期日:
15/05/12-15/07/12
minimum 15 May 2012 maximum 15 July 2012, the exact period in Charterers option
以上是列中的单元格值,我需要显示该值的唯一第一行,即 15/05/12-15/07/12
To_Char(b.Charter_End_Date, 'DD/MM/RR') || Period_Notice "Expiry Date",
预期结果:
15/05/12-15/07/12
实际结果:
15/05/12-15/07/12
minimum 15 May 2012 maximum 15 July 2012, the exact period in Charterers option
解决方案
子字符串,最多CHR(10)
,可能是您要查找的内容:
SQL> select * From test;
COL
--------------------------------------------------------------------------------
15/05/12-15/07/12
minimum 15 May 2012 maximum 15 July 2012, the exact period in Charterers option
SQL> select substr(col, 1, instr(col, chr(10))) result
2 from test;
RESULT
--------------------------------------------------------------------------------
15/05/12-15/07/12
SQL>
推荐阅读
- c++ - 二进制“<<”:未找到采用“c1”类型的右侧操作数的运算符
- javascript - 从Javascript中的字符串中删除除数值之外的所有值
- node.js - 在 cPanel 主机上运行的节点应用程序在闲置 30 分钟后关闭
- python - Terraform 抱怨 lambda 中使用了列表
- python - 烧瓶在 send_file() 后无法删除文件
- firebase - 关于firestore更改的本地通知
- oracle - 在 JMeter 中测试存储过程 - 格式错误
- typo3 - TYPO3 11.5.2 静态模板“站点包”未显示
- ios - iOS:- 错误:无法创建存储目录。错误域 = NSCocoaErrorDomain 代码 = 512
- selenium - Google Analytics 错误:尝试使用 Selenium 和 ChromeOption Arg headless 在已分配的自定义维度错误中发送命中有效负载长度