首页 > 代码库 > Oracle技术_字符串处理_截取文件名或扩展名

Oracle技术_字符串处理_截取文件名或扩展名

截取文件名:

SELECT SUBSTR('pop.kid.orc.txt', 1, INSTR('pop.kid.orc.txt', '.', -1) - 1) AS FILE_NAME
  FROM DUAL;

截取扩展名:

SELECT SUBSTR('pop.kid.orc.txt',
              INSTR('pop.kid.orc.txt', '.', -1) + 1,
              LENGTH('pop.kid.orc.txt')) AS FILE_NAME
  FROM DUAL;

点击进入ooppookid的博客

Oracle技术_字符串处理_截取文件名或扩展名