一、截取指定字符串左边数据
select substr('AAA-BBB',1,instr('AAA-BBB','-',-1)-1) 值 from dual;
二、截取指定字符串右边数据
select substr('AAA-BBB',instr('AAA-BBB','-',-1)+1) 值 from dual;
三、指定位数自动补0
select replace(lpad('11',5),' ','0') "5位" from dual
一、截取指定字符串左边数据
select substr('AAA-BBB',1,instr('AAA-BBB','-',-1)-1) 值 from dual;
二、截取指定字符串右边数据
select substr('AAA-BBB',instr('AAA-BBB','-',-1)+1) 值 from dual;
三、指定位数自动补0
select replace(lpad('11',5),' ','0') "5位" from dual