Chinaunix首页 | 论坛 | 博客
  • 博客访问: 208976
  • 博文数量: 63
  • 博客积分: 1470
  • 博客等级: 上尉
  • 技术积分: 640
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-27 10:24
文章分类

全部博文(63)

文章存档

2014年(2)

2011年(3)

2010年(4)

2009年(9)

2008年(45)

我的朋友

分类: Oracle

2009-02-27 13:21:44

在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'

阅读(523) | 评论(0) | 转发(0) |
0

上一篇:Linux下查看版本

下一篇:无法清除DNS缓存

给主人留下些什么吧!~~