oracle中translate与replace的使用
1.translate
语法:TRANSLATE(char, from, to)
用法:返回将出现在from中的每个字符替换为to中的相应字符以后的字符串。
若from比to字符串长,那么在from中比to中多出的字符将会被删除。
三个参数中有一个是空,返回值也将是空值。
举例:SQL> select translate('abcdefga','abc','wo') 返回值 from dual;
返回值
-------
wodefgw
分析:该语句要将'abcdefga'中的'abc'转换为'wo',
由于'abc'中'a'对应'wo'中的'w',
故将'abcdefga'中的'a'全部转换成'w';
而'abc'中'b'对应'wo'中的'o',
故将'abcdefga'中的'b'全部转换成'o';
'abc'中的'c'在'wo'中没有与之对应的字符,
故将'abcdefga'中的'c'全部删除;
简单说来,就是将from中的字符转换为to中与之位置对应的字符,
若to中找不到与之对应的字符,返回值中的该字符将会被删除。
在实际的业务中,可以用来删除一些异常数据,
比如表a中的一个字段t_no表示电话号码,
而电话号码本身应该是一个由数字组成的字符串,
&n
相关文档:
select dbtimezone from dual ; --查看数据库时区
select sessiontimezone from dual ; --查看会话时区
1.select u.name || '.' || o.name || '.' || c.name TSLTZcolumn
from sys.obj$ o, sys.col$ c, sys.user$ u
&nbs ......
AIX Oracle RAC 升级到10.2.0.4.0过程有如下报错(直接升级到10.2.0.4不需要应用Patch:6160398):
root@bwgl_db2:/u01/app/oracle/crs_1/bin# /u01/app/oracle/crs_1/install/root102.sh
Error : Please change the CRS_ORACLE_USER id <oracle> to have the following OS capabilities :
<CAP_BYP ......
一、安装(略)
服务器端
1、windows:(略)
2、linux:待续...
客户端
待续...
--包括配置--
二、登陆
......
先看一段ORACLE官方文档
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96520/analysis.htm#25806:
FIRST/LAST Functions
The FIRST/LAST aggregate functions allow you to return the result of an aggregate applied over a set of rows that rank as the first or last with respect to a ......
oracle cast() 函数问题
SQL> create table t1(a varchar(10));
Table created.
SQL> insert into t1 values ('12.3456');
1 row created.
SQL> select round(a) from t1;
ROUND(A)
----------
12
SQL> select round(a,3) from t1;
ROUND(A,3)
- ......