Oracle中Lpad函数和Rpad函数的用法
一、Lpad函数 lpad函数将左边的字符串填充一些特定的字符其语法格式如下:lpad(string,n,[pad_string]) string n pad_string lpad(‘tech‘,7); 将返回‘ tech‘ SELECT lpad(SEQ_DZSBK_XL.nextval,9,0) FROM dual;//序列值不满9位左边自动填充为0
rpad函数将右边的字符串填充一些特定的字符其语法格式如下:rpad(string,[pad_string]) string n pad_string rpad(‘tech‘,7); 将返回‘ tech‘rpad(‘tech‘,2); 将返回‘te‘rpad(‘tech‘,‘0‘); 将返回‘tech0000‘rpad(‘tech on the net‘,‘z‘); 将返回‘tech on the net‘rpad(‘tech on the net‘,‘z‘); 将返回‘tech on the netz‘ (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |