ORACLE 10 (付首昕)学习笔记 第2节 命令。
ORACLE 10 学习笔记-第2节-命令。
1. inner join / left join/ right join / full join
select a.dname, b.ename from dept a, emp b where a.deptno=b.deptno and a.deptno=10;
select a.dname, b.ename from dept a inner join emp b
on a.deptno=b.deptno and a.deptno=10;
select dname,ename from dept natural join emp;
select a.dname,b.ename from dept a left join emp b
on a.deptno=b.deptno and a.deptno=10;
select a.dname, b.ename from dept a right join emp b
on a.deptno=b.deptno and a.deptno=10;
select a.dname, b.ename from dept a, emp b where a.deptno=b.deptno(+) and b.deptno(+)=10;
2. 单行子查询
select ename,sal,deptno from emp where deptno=
(select deptno from emp where ename='scott');
select ename,job,sal,deptno from emp where job in
(select distinct job from emp where deptno=10);
select ename,sal,deptno from emp where sal>all
(select sal from emp where deptno=30);
3.建立触发器
create [or replace] trigger grigger_name
timing event1 [or event2 or event3]
on table_name
pl/sql block;
4.休息日不能修改雇员信息
create or replace trigger tr_sec_emp
before insert or update or delete on emp
begin
if to_char(sysdate,'DY','nls_date_language=AMERICAN')
IN ('SAT','SUN') THEN
case
when inserting then
raise_application_error(-20001,'不能在休息日增加雇员');
when updateing then
raise_application_error(-20001,'不能在休息日更新雇员');
when deleteing then
raise_application_error(-20001,'不能在休息日解雇雇员');
end case;
end if;
end;
/
5.
create table audit_table(
name varchar2(20),ins int,upd int,del int,
starttime date,endtime date);
6.
create or replace trigger tr_audit_emp
after insert or update or delete on emp
declare
v_temp in
相关文档:
关系型数据库理论中字段值必须是单值,而oracle中允许在一个字段中存储一个表的内容。
如:员工表中的外键 部门编号,oracle中这个字段可以存放部门的记录而并不是一个外键,这样查询时候的效率会提高。
可变数组:
创建带有可变数组的表
创建可变数组基类型
create or replace type 基类型名 as object(字段清单);
......
Lately,
Jordan bank upgraded their ICBS banking software to Oracle 9i and
IDS9i. The Bank also moved from a decentralized to a centralized
system.
We were contracted to monitor and diagnose performance issues during the launching phase of the new system.
The IBM server was equipped with 32 GB o ......
现在看相关的RAC结构的文章还不太理解。
现在看这个就很清楚其中的意思了。
oracle clusterware 主要有以下主要部件:
CSS: 集群同步服务
主要管理整个集群内各个节点间的情况,包括节点的添加和减少。与之对应的是ocssd 进程,如果改进程出现故障将会导致节点重启。如果使用了第三方的clusterware,css 通过第三方clus ......
事关CUBE ROLLUP GROUPING SETS(1)
原文引自: 聚合是数据仓库的基础。为了提高聚合的性能。Oracle提供了Group By 条款的扩展。
1. CUBE, ROLLUP扩展
2. 3个grouping函数
3. Grouping set扩展
CUBE ROLLUP ......
在Oracle中的树形操作
1.取子节点及路径(正树):
select t.id ,t.code, t.name ,t.pid
,SYS_CONNECT_BY_PATH(t.id,'.')||'.' as IdPath
from tas_catalog t
--where id!=110
start with id=110
connect by pid = prior id
order siblings by id
2.取各级父节点(倒树):
select t.id ,t.code, t.na ......