Oracle dd-m月-yy转yyyy-mm-dd
表名称:TEST_LP
字段:PROD_DATE
1 SELECT '20' || SUBSTR(T.PROD_DATE, INSTR(T.PROD_DATE, '-', 1, 2) + 1, 2) || '-' || 2 DECODE(LENGTH(SUBSTR(T.PROD_DATE, 3 INSTR(T.PROD_DATE, '-', 1, 1) + 1, 4 LENGTH(SUBSTR(T.PROD_DATE, 5 INSTR(T.PROD_DATE, '-', 1, 1) + 1)) - 6 LENGTH(SUBSTR(T.PROD_DATE, 7 INSTR(T.PROD_DATE, '月', 1, 1))))), 8 1, 9 '0') || 10 SUBSTR(T.PROD_DATE, 11 INSTR(T.PROD_DATE, '-', 1, 1) + 1, 12 LENGTH(SUBSTR(T.PROD_DATE, INSTR(T.PROD_DATE, '-', 1, 1) + 1)) - 13 LENGTH(SUBSTR(T.PROD_DATE, INSTR(T.PROD_DATE, '月', 1, 1)))) || '-' || 14 SUBSTR(T.PROD_DATE, 1, 2) AS PROD_DATE 15 FROM TEST_LP T
varchar2 类型 的 dd-m月-yy 亲测有效
本文来自博客园,作者:bigroc,转载请注明原文链接:https://www.cnblogs.com/bigroc/p/10650657.html
blog:http://www.bigroc.cn 博客园:https://www.cnblogs.com/bigroc