互联网服务

这是DB2错误码sql20165n的BUG吗?

test1:--成功with t as(select * from old table (delete from taba))select c.col1,c.col2from t c join tabb d on c.col1 = d.col1--失败,报sql20165nselect c.col1,c.col2 from (select * from old table (delete from taba)) cjoin tabb d on c.col1 = d.col1 ;test2...显示全部

test1:

--成功

with t as(select * from old table (delete from taba))

select c.col1,c.col2

from t c join tabb d on c.col1 = d.col1


--失败,报sql20165n

select c.col1,c.col2 from (select * from old table (delete from taba)) c

join tabb d on c.col1 = d.col1 ;



test2:

--成功

with t as (select * from old table (delete from taba))

select * from t;


--失败,报sql20165n

select * from (select * from old table (delete from taba))


--环境:

G:UsersAdministrator>db2level

DB21085I  实例 "DB2" 使用 "64" 位和 DB2 代码发行版 "SQL09074",级别标识为

"08050107"。

参考标记为 "DB2 v9.7.400.501"、"s110330" 和 "IP23238",修订包为 "4"。

产品使用 DB2 副本名 "DB2COPY1" 安装在 "D:PROGRA~2IBMSQLLIB" 中。


--------------


曾经在工作中试过在merge的using字句里面写update,并执行成功,当时忘记是什么版本,现在再在merge里面怎么写也报这个错误!

收起
参与3

查看其它 1 个回答jianghshun的回答

jianghshunjianghshun其它null
DB2对这个错误码的说明,跟你的测试结果刚好相符。

SQL20165N  在指定 SQL 数据更改语句的上下文中,不允许 FROM 子句
      中的 SQL 数据更改语句。

说明:

可以在特定上下文的 FROM 子句中指定 SQL 数据更改语句。SQL 数据更改语句必
须是用于下列各项中的 FROM 子句中的唯一表引用:
*  SELECT 语句的外层全查询
*  SELECT INTO 语句
*  公共表表达式的外层全查询
*  赋值语句中的唯一全查询。
IT其它 · 2013-04-29
浏览684

回答者

jianghshun
其它null

jianghshun 最近回答过的问题

回答状态

  • 发布时间:2013-04-29
  • 关注会员:1 人
  • 回答浏览:684
  • X社区推广