oracle的一些知识小结
Sql中两个“-”表示注释的开始。
拼接运算符:”||”,注意:只有在所有的运算符为null时,拼接的结果是null。
比较运算符用于比较两个值或表达式,给出一个布尔型的结果 true,false,null.
比较运算符:
=
!= <> ^=
[not]in 包含
Any some 将一个值与列表中的每个值或者与查询结果中的每一个值进行比较,假如查询没有返回结果,则结果为false。前面必须有=,!=,>=,<等符号。
Select last_name from emp where salary<=any(select salary from emp where deptno=10);
All 将一个值与列表中的每个值或者与查询结果中的每个值进行比较,假如查询没有返回结果,则结果为true。前面必须有=,!=,<,>等符号。
Select last_name from emp where salary<=all(500,1000.9000);
[not] between a and b
Select last_name from emp where salary between 4000 and 10000;
[not] exists 假如一个子查询至少返回一行时,结果为true
Select last_name from emp a where not exists(select ‘x’ dummu from emp b where b.deptno=10 and a.last_name=b.last_name);
A [not] like b [escape ‘char’] 用于模式匹配;假如模式a与模式b匹配,则结果为true。模式匹配符%用于匹配0个或任意多个字符。_用于匹配一个字符。关键字escape用于提示oracle解释%和_字符,不要将他们作为特殊字符串处理。
Select last_name from emp where last_name not like ‘Th%’;
Select last_name from emp where last_name like ‘_tt%’;
Select synonym_name from dba_synonums wnere synonym_name like ‘all\_u%’escape’\’;
Is [not] null 只有一个运算符,用来测试其值是否为空。
Select last_name from emp where salary is not null;
逻辑运算符:
Not 将结果取反。假如运算数是null,则返回null,当运算数是false时,结果返回true,否则返回false。
Select * from emp where not (salary<100)
And 假如所有的运算数为true,则结果为true;如果其中一个为false,则结果为false。否则结果是null。
Or假如所有的运算数为false,则结果为false;如果其中一个为true,则结果为true。否则结果是null。
集合运算符:
Union 返回所有查询结果中的行,不包括重复的值
相关文档:
CSDN里的一个朋友问到了这个索引覆盖的概念。 这个概念很小的知识点,在我的论坛里有解释“”,不过作为Oracle版主,不能在回帖里加上网外的地址链接,所以这里在CSDN里帖上一份
比如有复合索引为3个字段:f1 + f2 + f3,请问:
1: select f1, f2, f3, f4 from table where f1 = 'XX' and f2 = 'XX'. ......
一、UTL_INADDR包获取ip地址
今天有朋友在MSN上问我如何获得已经连接用户的IP地址。
我们知道,通过SYS_CONTEXT函数可以获得这部分信息,当前用户的ip等信息可以通过如下命令轻易获取:
SQL> select sys_context('userenv','host') from dual;
SYS_CONTEXT('USERENV','HOST')
------------------------------ ......
经过长时间学习创建Oracle表空间,于是和大家分享一下,看完本文你肯定有不少收获,希望本文能教会你更多东西。
1、先查询空闲空间
select tablespace_name,file_id,block_id,bytes,blocks from dba_free_space;
2、增加Oracle表空间
先查询数据文件名称、大小和路径的信息,语句如下:
select&n ......
我们的Oracle管理工作中经常涉及到更改Oracle用户属性、密码之类的常用操作;但在某些应用场景下,会遇到Oracle用户名更改的需求,如何解决?下面通过四个步骤实现Oracle用户名的修改。
一、查询更改Oracle用户名
SQL> select user#,name,password from user$ where name ='TICKET ......
update t_tmprpt_firstreplycosttime t
set (t.firstreplytime,
t.dealstaff,
t.firstreplyfailcontent)
= (select a.suggesttime,
a.suggester,
substr(a.remark,instr(a.remark,'】',1)+2)
from t_wf_suggesthis a
......