Why can't I do a “with x as (…)” with ADODB and Oracle?

与世无争的帅哥 提交于 2019-11-29 04:17:50

Ok, it really seems as though ADODB expects a query statement to actually start with select. Therefore, a work around for the problem might be to enclose the statement in a select * from ( .... ) like so:

Dim sql As String
sql = "with w as (select 'foo' x from dual) select x from w"

' enclose the statement:
sql = "select * from (" & sql & ")"

rs.Open sql, cn

Above method did not work for me.

Adding ";" prior to WITH keyword resolved the issue.

Dim sql As String sql = ";with w as (select 'foo' x from dual) select x from w"

rs.Open sql, cn

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!