Oracle lpad 函数
Oracle lpad 函数:
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://soysky.blogbus.com/logs/43623642.html
Oracle 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'
Lpad(str1,number,str2),简单说这个函数的意思是,如果str1不足number那么多位,则使用str2去补齐左边的空
eg:
SELECT lpad('***', 6, 'orcal') from dual
--结果
orc***
相关文档:
这篇文章阐述了如何管理oracle ERP的interface表
这篇文章阐述了如何管理oracle ERP的interface表
http://blog.oraclecontractors.com/?p=212
There are a number of tables used by Oracle Applications that should have no rows in them when all is running well, and if any, only a few rows that are in error. ......
ORACLE日期时间函数大全
TO_DATE格式(以时间:2007-11-02 13:45:25为例)
Year:
yy two digits 两位年 &nb ......
日前遇到一个问题,需要对在Oracle数据库中查询出来的数值进行比率的计算。类似于如下的SQL:
Select Round((discount/Amount),2) from dual;
这样算出来的数字可以满足绝大部分的需求。但是对于不到1的数字,问题出来了......显示的类似于 .45样子的数据。0.45前面的0不见了。
以下总结了两种方法来解决缺0的问题。
第 ......
ORACLE 10 学习笔记-第4课-命令。
1.commit;rollback;
2.select * from dictionary;
describe dba_users;
select * from dba_users;
select name from v$controlfile;
3.
alter database drop logfile group 3
select archiver from v$instance;
alter tablespace userdata read only;
4.
select tablespace_nam ......
SELECT ID,
col_name,
SUBSTR(col_name, 1, INSTR(col_name || ',', ',', 1, 1) - 1) C1,
SUBSTR(col_name,
......