update的一些注意的语法

文档地址:http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_10007.htm#i2073065

 

update_set_clause::=

Description of update_set_clause.gif follows
Description of the illustrationupdate_set_clause.gif

 

update_set_clause

The update_set_clause lets you setcolumn values.

column

Specify the name of a column of the object that is to beupdated. If you omit a column of the table from theupdate_set_clause, then thevalue of that column remains unchanged.

If column refers to a LOB objectattribute, then you must first initialize it with a value of emptyor null. You cannot update it with a literal. Also, if you areupdating a LOB value using some method other than a directUPDATE SQL statement, then you must first lock the rowcontaining the LOB. See for_update_clause for moreinformation.

If column is part of thepartitioning key of a partitioned table, then UPDATEwill fail if you change a value in the column that would move therow to a different partition or subpartition, unless you enable rowmovement. Please refer to the row_movement_clause of CREATE TABLE or ALTER TABLE.

In addition, if column is part of thepartitioning key of a list-partitioned table, thenUPDATE will fail if you specify a value for the columnthat does not already exist in the partition_value list of one ofthe partitions.

subquery

Specify a subquery that returns exactly one row for each rowupdated.

  • If you specify only one column in the update_set_clause, then thesubquery can return only one value.

  • If you specify multiple columns in the update_set_clause, then thesubquery must return as many values as you have specifiedcolumns.

  • If the subquery returns no rows, then the column isassigned a null.

  • --如果子查询中没返回任何行,那么列值将被分配为空。

  • If this subquery refers to remoteobjects, then the UPDATE operation can run in parallelas long as the reference does not loop back to an object on thelocal database. However, if the subquery in theDML_table_expression_clauserefers to any remote objects, then the UPDATEoperation will run serially without notification.

You can use the flashback_query_clause withinthe subquery to update table with past data. Pleaserefer to the flashback_query_clause ofSELECT for more information on this clause.



 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值