翻譯自:
http://mfm088.itpub.net/post/22599/250400 在Oracle/PLSQL中,lpad函數將左邊的字符串填充一些特定的字符,其語法格式如下:
lpad( string1, padded_length, [ pad_string ] )
其中string1是需要粘貼字符的字符串
padded_length是返回的字符串的數量,如果這個數量比原字符串的長度要短,lpad函數將會把字符串截取成padded_length;
pad_string是個可選參數,這個字符串是要粘貼到string1的左邊,如果這個參數未寫,lpad函數將會在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)
評論(18) 編輯 收藏 所屬分類:
Oracle