用merge遇到的有关问题
用merge遇到的问题
SQL> merge into book b
2 using book1 b1
3 on (b.bookid = b1.bookid)
4 when matched then
5 update set b.bookid = 'tp2001--001'
6 when not matched then
7 insert values (br.bookid, br.cardid, br.bdate, br.sdate);
merge into book b
*
第 1 行出现错误:
ORA-00947: 没有足够的值
这是什么问题,神马情况啊
------解决方案--------------------
官方文档说的很清楚了:
http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_9016.htm#SQLRF01606
Restrictions on the merge_update_clause This clause is subject to the following restrictions:
You cannot update a column that is referenced in the ON condition clause.
You cannot specify DEFAULT when updating a view.
SQL> merge into book b
2 using book1 b1
3 on (b.bookid = b1.bookid)
4 when matched then
5 update set b.bookid = 'tp2001--001'
6 when not matched then
7 insert values (br.bookid, br.cardid, br.bdate, br.sdate);
merge into book b
*
第 1 行出现错误:
ORA-00947: 没有足够的值
这是什么问题,神马情况啊
------解决方案--------------------
官方文档说的很清楚了:
http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_9016.htm#SQLRF01606
Restrictions on the merge_update_clause This clause is subject to the following restrictions:
You cannot update a column that is referenced in the ON condition clause.
You cannot specify DEFAULT when updating a view.