Hello
I fail to execute an SQL query with a with clause via ADODB and Oracle.
That is, the following snippet works:
Dim cn As ADODB.connection
Set cn = ....
Dim rs As ADODB.recordSet
Set rs = New ADODB.Recordset
rs.Open "select 'foo' x from dual", cn
Do While Not rs.eof
...
rs.MoveNext
Loop
However, the following doesn't work - it genererats a Run-Time error 3704: Operation is not allowed when the object is closed.
Dim cn As ADODB.connection
Set cn = ....
Dim rs As ADODB.recordSet
Set rs = New ADODB.Recordset
rs.Open "with w as (select 'foo' x from dual) select x from w", cn
Do While Not rs.eof
...
rs.MoveNext
Loop
Obviously, this is a trimmed-down demonstration of the real problem which consists of a more sophisticated query.
It seems to me that ADODB sort of parses the query before it passes it to the Oracle instance and does not understand the with clause. Anyway, any help on this is highly appreciated.