DB2 9.7中merge into with as问题

近期在搞ORACLE转DB2的工作,发现有个多层嵌套的SQL解决不了,想通过DB2支持的语法翻译ORACLE的逻辑:

merge into ... a

using (

  with t as (...)

  with t2 as (...)

  select ... from t,t2 ...

)

do update ...

do insert ...

参与3

1同行回答

andy_zhanglmandy_zhanglm其它IBM
你是指下面用法通不过吗?using (  with t as (...)  with t2 as (...)  select ... from t,t2 ...)我测试了一下,是有问题, 如果这种场景不多, 看能否用VIEW的方式绕过去create view myview1 as with t as (...)  with t2 as (....显示全部

你是指下面用法通不过吗?

using (

  with t as (...)

  with t2 as (...)

  select ... from t,t2 ...

)

我测试了一下,是有问题, 如果这种场景不多, 看能否用VIEW的方式绕过去

create view myview1 as

with t as (...)

  with t2 as (...)

  select ... from t,t2 ...

然后在MERGE中

using (

select ... from myview1

)

收起
软件开发 · 2017-06-02
浏览3579

提问者

qw19735
软件架构设计师北京软件公司

问题来自

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2017-05-24
  • 关注会员:2 人
  • 问题浏览:6048
  • 最近回答:2017-06-02
  • X社区推广