转换系统日期格式语句 alter session set NLS_DATE_LANGUAGE = American
select '20' || substr(c_col3, instr(c_col3, '-', 1, 2) + 1, 2) || '-' ||
decode(length(substr(c_col3,
instr(c_col3, '-', 1, 1) + 1,
length(substr(c_col3,
instr(c_col3, '-', 1, 1) + 1)) -
length(substr(c_col3, instr(c_col3, '月', 1, 1))))),
1,
'0') ||
substr(c_col3,
instr(c_col3, '-', 1, 1) + 1,
length(substr(c_col3, instr(c_col3, '-', 1, 1) + 1)) -
length(substr(c_col3, instr(c_col3, '月', 1, 1)))) || '-' ||
substr(c_col3, 1, 2)
from hr_dyd_zyjszwxx
INSTR(C1,C2,I,J)
在一个字符串中搜索指定的字符,返回发现指定的字符的位置;
C1 被搜索的字符串
C2 希望搜索的字符串
I 搜索的开始位置,默认为1
J 出现的次数,默认为1
SQL> select instr(’oracle traning’,’ra’,1,2) instring from dual; --ra第二次出现的位置
INSTRING
---------
9
LENGTH
返回字符串的长度;
substr()取自字符串