1. 在Oracle/PLSQL中,lpad函数将左边的字符串填充一些特定的字符,其语法格式如下:      
  2.  
  3.      lpad( string1, padded_length, [ pad_string ] )  
  4.      其中string1是需要粘贴字符的字符串  
  5.      padded_length是返回的字符串的数量,如果这个数量比原字符串的长度要短,lpad函数将会把字符串截取成padded_length;  
  6.  
  7.      pad_string是个可选参数,这个字符串是要粘贴到string1的左边,如果这个参数未写,lpad函数将会在string1的左边粘贴空格。  
  8.     例如:  
  9.  
  10.  
  11. lpad('tech', 2); 将返回'te'   
  12. lpad('tech', 8, '0'); 将返回'0000tech'   
  13. lpad('tech on the net', 15, 'z'); 将返回 'tech on the net'   
  14. lpad('tech on the net', 16, 'z'); 将返回 'ztech on the net' 
  15.  
  16.    
  17.    
  18.  
  19. Rpad()函数的用法:  
  20. rpad函数将右边的字符串填充一些特定的字符其语法格式如下:      
  21.      rpad(string,n,[pad_string])  
  22.      string:可是字符或者参数  
  23.      n:字符的长度,是返回的字符串的数量,如果这个数量比原字符串的长度要短,lpad函数将会把字符串截取成从左到右的n个字符;  
  24.      pad_string:是个可选参数,这个字符串是要粘贴到string的右边,如果这个参数未写,lpad函数将会在string的右边粘贴空格。  
  25.     例如:  
  26. rpad('tech', 7); 将返回' tech'   
  27. rpad('tech', 2); 将返回'te'   
  28. rpad('tech', 8, '0'); 将返回'tech0000'   
  29. rpad('tech on the net', 15, 'z'); 将返回 'tech on the net'   
  30. rpad('tech on the net', 16, 'z'); 将返回 'tech on the netz'