易截截图软件、单文件、免安装、纯绿色、仅160KB

转: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多行记录合并/连接/聚合字符串的几种方法

什么是合并多行字符串(连接字符串)呢,例如:
SQL> desc test;
Name     Type          Nullable Default Comments
------- ------------ -------- ------- --------
COUNTRY VARCHAR2(20) Y       &nb ......

Oracle多行记录合并/连接/聚合字符串的几种方法

什么是合并多行字符串(连接字符串)呢,例如:
SQL> desc test;
Name     Type          Nullable Default Comments
------- ------------ -------- ------- --------
COUNTRY VARCHAR2(20) Y       &nb ......

Oracle 1z0 047 Exam


Exam Number/Code : 1z0-047
Exam Name : Oracle Database SQL Expert
Questions and Answers : 278 Q&As
Update Time: 2010-04-15
1. Which two statements are true regarding the execution of the correlated subqueries? (Choose two.)
A. The nested query executes after the outer query returns th ......

oracle 10g em、isqlplus访问不了的问题解决

如果web方式的em,isqlplus访问不了。
1. 检查主机名/IP、端口是否正确
安装时的主机名/IP、端口记录在$ORACLE_HOME/install/portlist.ini 文件中。
缺省是:
一般用户                    
http://ip:5560/isq ......

Oracle中SQL PLUS的常用指令

进入sql*plus需要输入用户名、口令和主机标志符
system/manager
sys/change_on_intall
scott/tiger
internal/oracle
以上为初始密码
主机字符串空或者是@+你的服务名,在本地登陆不需要本地服务名。
下面就介绍一下一些常用的sql*plus命令:
首先查看当前使用的数据库实例:
select name from V$database;
切换两个 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号