官方文档地址:http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_10007.htm#SQLRF01708
update_set_clause::=
Description of the illustrationupdate_set_clause.gif
---update语句中SETXXX=DEFAULT(XXX为具体表列)
DML_table_expression_clause::=
Description of theillustration DML_table_expression_clause.gif
DML_table_expression_clause
The ONLY
clause applies only to views. SpecifyONLY
syntax if the view in the UPDATE
clause is a view that belongs to a hierarchy and you do not want toupdate rows from any of its subviews.
See Also:
"Restrictionson the DML_table_expression_clause" and "Updating a Table: Examples"
schema
Specify the schema containing the object to be updated. If youomit schema
, then the databaseassumes the object is in your own schema.
table | view |materialized_view |subquery
Specify the name of the table, view, materialized view,or the columns returned by a subquery to be updated.--指定的表、视图、物化视图、或者由子查询返回的列去被更新。
注意:根据UPDATE的语法,如果DML_table_expression_clause字句中是子查询的话,那么在这个子查询涉及的表返回的列上才允许被更新,在这表上的其它列,如果出现这个UPDATE语句的字句updateset clause当中的话,更行会报错 : ORA-00904:某某列为无效标示符。
例如:
Update
(Select bb From test11)
Set cc='33'--此表两列:BB,CC。
但子查询返回的列是BB,要更新的CC,因此收到一个报错信息。
如果要更新的是子查询返回的列BB,而且更新的列也是BB,不是CC,那么更新可以成功进行。
Issuing an UPDATE
statement against a table firesany UPDATE
triggers associated with the table.
If you specifyview
,then the database updates the base table of the view. You cannotupdate a view except with INSTEAD
OF
triggers if the defining query of the view contains one of thefollowing constructs:
DISTINCT
operator
GROUP
BY
,
ORDER
BY
,
MODEL
,
CONNECT
BY
, or
START
WITH
clause
SELECT
list
SELECT
list
WITH READ ONLY
You cannot update more than one base table through a view.
In addition, if the view was created with the WITH
CHECK
OPTION
, then you can update theview only if the resulting data satisfies the view's definingquery.
If table
or the base table ofview
contains one or more domain index columns, then this statementexecutes the appropriate indextype update routine.
You cannot update rows in a read-only materialized view. If youupdate rows in a writable materialized view, then the databaseupdates the rows from the underlying container table. However, theupdates are overwritten at the next refresh operation. If youupdate rows in an updatable materialized view that is part of amaterialized view group, then the database also updates thecorresponding rows in the master table.