Wednesday, February 8, 2017

lpad substring in PL SQL


select  ltrim(rtrim(CCNAME)) aaa, length(ltrim(rtrim(CCNAME))) fkj,  
 '000000'|| substr(ltrim(rtrim(CCNAME)),-length(ltrim(rtrim(CCNAME))),30),
 LPAD(substr(ltrim(rtrim(CCNAME)),1,6),50-length(ltrim(rtrim(CCNAME))),0),
 RPAD('000000'|| substr(ltrim(rtrim(CCNAME)),-length(ltrim(rtrim(CCNAME))),23), 10)
 from  PRODDTA.F0010

No comments: