翻譯自:
http://mfm088.itpub.net/post/22599/250400 在Oracle/PLSQL中,lpad函數(shù)將左邊的字符串填充一些特定的字符,其語法格式如下:
lpad( string1, padded_length, [ pad_string ] )
其中string1是需要粘貼字符的字符串
padded_length是返回的字符串的數(shù)量,如果這個(gè)數(shù)量比原字符串的長度要短,lpad函數(shù)將會(huì)把字符串截取成padded_length;
pad_string是個(gè)可選參數(shù),這個(gè)字符串是要粘貼到string1的左邊,如果這個(gè)參數(shù)未寫,lpad函數(shù)將會(huì)在string1的左邊粘貼空格。
例如:
lpad('tech', 7); |
將返回' tech' |
lpad('tech', 2); |
將返回'te' |
lpad('tech', 8, '0'); |
將返回'0000tech' |
lpad('tech on the net', 15, 'z'); |
將返回 'tech on the net' |
lpad('tech on the net', 16, 'z'); |
將返回 'ztech on the net' |
posted on 2007-04-26 11:21
阿蜜果 閱讀(18651)
評(píng)論(18) 編輯 收藏 所屬分類:
Oracle