oracle數據庫update語句
update兩表關聯的寫法包括字查詢
* t2 set parentid=(select ownerid from t1 where *=*);
2. update tb_client_win_lost_report a set *g_code_id=2
where game_code_id=70000
and exists
(select 'x' from (select *
from (select id,level_ from tb_admin_role connect by prior id=parent_id start with id =1) a,
(select lv_id from tb_rolling_plan where rolling_code_id = 2 and game_code_id=70000) b
where *_id=*) c where *_id=*)
and rolling_code_id=1
3. update (select rolling_code_id from tb_client_win_lost_report a,temp_role_id b
where *_id=*
and rolling_code_id=1) a set *g_code_id=2;
4. update tb_client_win_lost_report a set *g_code_id=2
where game_code_id=70000
and exists
(select 'x' from (select id from temp_role_id) c where *_id=*)
and rolling_code_id=1
and rownumcommit;
* 多個字段的寫法
update a set (c1,c2,c3) =(select b1,b2,b3 from b where。。) where 。。;
求 oracle update 語句 一個能用的例子
Update 語句
Update 語句用于修改表中的數據。
語法:
UPDATE 表名稱 SET 列名稱 = 新值 WHERE 列名稱 = 某值
更新某一行中的一個列
我們為 lastname 是 "Wilson" 的人添加 firstname:
UPDATE Person SET FirstName = 'Fred' WHERE LastName = 'Wilson'
更新某一行中的若干列
我們會修改地址(address),并添加城市名稱(city):
UPDATE Person SET Address = 'Zhongshan 23', City = 'Nanjing'
WHERE LastName = 'Wilson'
推薦你一個學習基礎的網站:
http://**sql/*
oracle數據庫update語句
1. 使用b表數據更新a表,那么where條件是什么,也就是說,更新a表中哪些數據,用b表中的哪些數據更新,二者的關系是什么。從你的語句中我看不出b表和a表的關聯。
2. 找到關聯條件后,通過關聯條件查出的b表數據是否唯一,如果不唯一,還是會出現“返回值多于一行”的錯誤。
3. 按照你的表結構和數據,假設A表和B表中的name列唯一,以name作為關聯,可以這樣寫來實現你的更新目的。
4. update A set cou2 = (select B_cou1 from B where B.B_name = *) where name in (select B_name from B where B.B_name = *)
5. 這條語句必須滿足name在a、b表中唯一的條件,才能使用。
6. 甲骨文股份有限公司是全球大型數據庫軟件公司,總部位于美國加州紅木城的紅木岸。在2008年,甲骨文股份有限公司是繼Microsoft及IBM后,全球收入第三多的軟件公司。
7. Oracle數據庫產品為財富排行榜上的前1000家公司所采用,許多大型網站也選用了Oracle系統。甲骨文股份有限公司于1989年正式進入中國,在北京、上海、廣州和成都均設立了分支機構。
8. 2016年1月,甲骨文表示會收購網站數據追蹤服務商AddThis。2016年2月,甲骨文收購了云計算創業公司Ravello Systems。2017年6月7日發布的2017年美國《財富》500強,甲骨文公司排名第81位。
9. 2017年6月,《2017年BrandZ最具價值全球品牌100強》公布,甲骨文公司排名第46位。
10. 20世紀約70年代一間名為Ampex的軟件公司,為中央情報局設計一套名叫Oracle的數據庫,埃里森是程序員之一。
oracle update語句的復雜寫法,求大神
好像是
一條update只能修改一張表里的字段,但是可以關聯多張表去修改。不知道你用的是什么數據庫。
常用的sqlserver格式如下:
update table1 set a.字段1=b.字段1,。.,a.字段N=b.字段N from table1 a,table2 b where 兩個表的關聯字段。
常用的oracle格式如下:
update table1 a set (a.字段1,。.,a.字段N) =(select b.字段1,。,b.字段N from table2 b where 兩個表的關聯字段) where exists (select 1 from table2 b where 兩個表的關聯字段)。
注意oracle語句里的exists不能省略,否則會導致沒有對應關系的數據修改錯誤,甚至會報錯。
轉載請注明出處華閱文章網 » oracle的update語句