转:ORACLE 多表关联 UPDATE 语句
转:ORACLE
多表关联 UPDATE 语句
原帖:http://www.cnblogs.com/miley/archive/2010/04/15/1712617.html
为了
方便起见
,建立了以下简单模型
,和构造了部分测试数据
:
在某个业
务受理子系统
BSS中,
--客户资
料表
create table customers
(
customer_id number(8) not null, -- 客户标示
city_name varchar2(10) not null, -- 所在城市
customer_type char(2) not null, -- 客户类型
...
)
create unique index PK_customers on customers
(customer_id)
由于某些
原因,客户所在城市这个信息并不什么准确,但是在
客户服务
部的
CRM子系统中,通过主动服务获取了部分
客户
20%的所在
城市等准
确信息,于是你将该部分信息提取至一张临时表中:
create table tmp_cust_city
(
customer_id number(8) not null,
citye_name varchar2(10) not null,
customer_type char(2) not null
)
1) 最简单的
形式
--经确
认
customers表中所有
customer_id小于
1000均为
'北京
'
--1000以内的均是公司走向全国之前的本城市的老客户
:)
update customers
set city_name='北京
'
where customer_id<1000
2) 两表
(多表
)关联
update -- 仅在
where字句中的连接
--这次
提取的数据都是
VIP,且包括新增的
,所以顺便更新客户类别
update customers a -- 使用别名
set customer_type='01' --01 为
vip,
00为普通
where exists (select 1
from tmp_cust_city b
&
相关文档:
服务器启动的过程
Oracle数据服务器的常规启动过程:
1、启动TNS监听 C:\Documents and Settings\Administrator>lsnrctl start
......
Oracle10G的EM采用了web方式,并且分成了2个产品,database control和grid control。这里主要介绍如何创建单数据的dbcontrol。Grid control需要下载单独的光盘安装。
在用DBCA建库的时候,可以选择是否启用dbcontrol,启用的话需要在
数据库
中建立一个sysman的schema,用于保存EM的一些数据,这个就是EM的资料库(reposi ......
---------------------------------------------------------------------------
---- 本文为andkylee个人原创,请在尊重作者劳动成果的前提下进行转载;
---- 转载务必注明原始出处
:
http://blog.csdn.net/andkylee
--- 2010-05-31 22:56:43
---- 关键字: oracle 分页 rownum
--------------------------------- ......
http://hi.baidu.com/lu_xinzhong/blog/item/4ff92b1725dec505c83d6d09.html
回滚表空间大小
-- 创建一个新的小空间的UNDO TABLESPACE
Create UNDO TABLESPACE UNDOTBS2 DATAFILE '/u01/app/oracle/oradata/orcl/UNDOTBS02.DBF' SIZE 100M REUSE AUTOEXTEND ON;
-- 设置新的表空间为系统UNDO_TABLESPACE
Alter SYSTE ......
CREATE TABLESPACE mySpace
datafile
'd:\data\data1.dbf' size 1M reuse
autoextend on next 100k maxsize 2M
'd:\data\data2.dbf' size 1M reuse
online
permanent;
其中online表联机。
联机和脱机的区别和使用
联机: ORACLE服务进程关联文件。可供oracle客户端访问.如果在系统中直接删除时会弹出异常。
脱机: ......