Oracle函数之substr
Oracle
函
数之substr
关键字: substr
substr函数有三个参数,允许你将目标字符串的一部份输出,
第一个参数为目标字符串,
第二个字符串是将要输出的子串的起点,
第三个参数是将要输出的子串的长度。
例子1:
substr('ABCDEFG', 2, 3) = 'BCD'
如果第二个参数为负数,那么将会从源串的尾部开始向前定位至负数的绝对值的位置。
例子2:
substr('ABCDEFG', -2) = 'FG'
substr('ABCDEFG', -4) = 'DEFG'
相关文档:
1、su – oracle 不是必需,适合于没有DBA密码时使用,可以不用密码来进入sqlplus界面。
2、sqlplus /nolog 或sqlplus system/manager 或./sqlplus system/manager@ora9i;
3、SQL>connect / as sysdba ;(as sysoper)或
connect internal/oracle AS SYSDBA ;(scott/tiger)
conn sys/change_on_install as sysd ......
为防忘记,记录于下:
oracle 11gR2 : http://www.oracle.com/pls/db112/homepage,下载网址http://www.oracle.com/technology/documentation/database.html
oracle 11gR1 : http://www.oracle.com/pls/db111/homepage
oracle 10gR2 : http://www.oracle.com/pls/db102/homepage ......
用命令行(CMD)中启动和关闭ORACLE服务
监听启动
lsnrctl start
监听停止
lsnrctl stop
启动Oracle
net start oracleservicesid
停止Oracle
net stop oracleservicesid
net命令是win系统命令!其它的服务启动和上面的类似!
......
delete from tbl_talbe
where (col1,col2,col3) in
(select col1,col2,col3
from tbl_table
group by col1,col2,col3
&nbs ......
也许对SQL Server来说,取前N位的数据是很简单的事情,一条TOP语句就搞定了.
在Oracle中我们往往会感觉到头疼,平日里也常会用到,主要是使用partition by.
语法如下:
select emp_card_no,work_date,read_card_date,count(rownum) as cnt
from hra_read_car ......