问题
I have a Mule application running a DB query which runs perfectly well (albeit a little bit slow). It's details are:
- Mule 3.7.2 EE
- Anypoint Studio 5.4.1
- jdk1.7.0_51
- Using oracle
ojdbc6
driver
Now when I create a database
connection using the ojdbc6
driver, without the use of a Common Table Expression (CTE) the query runs fine (at 2.5 secs).
When I utilise my CTE, the query fails with the error:
org.mule.api.MessagingException
: Query type must be one of '[SELECT, STORE_PROCEDURE_CALL]' but was 'DDL' (java.lang.IllegalArgumentException
). Message payload is of type: NullPayload
Clearly at some point the Mule EE server thinks that I'm trying to execute DDL when I'm not.
The new query, using the CTE, works perfectly fine (at .250 sec) in SQL Developer, so I know that it's not my query.
Why can't I use the CTE (WITH
) statement in Mule?
Is this a known issue? Am I doing something wrong?
Query (simplified) before CTE:
SELECT '1' AS COLUMN_ONE, 'X' AS COLUMN_X
FROM DUAL
Query (simplified) after CTE:
WITH TBL AS
(
SELECT '1' AS COLUMN_ONE, 'X' AS COLUMN_X
FROM DUAL
)
SELECT * FROM TBL
回答1:
As of 2016-04-27 the CTE statement is not supported by Mule.
I had to dig deep for this one.
- I tweeted this question and tagged @MuleSoft and @MuleDev
- To which I got the reply:
if you haven't already we'd also suggest posting this in the forums - http://forums.mulesoft.com
- To which I got the reply:
- I then posted the issue on the Mulesoft Forums
- To no avail
- I then logged a support ticket with Mulesoft (case number 00107313)
- To which I got the reply:
WITH is not currently supported by Mule ESB. Enhancement request(SE-987) has been raised but not implemented yet.
Engineering team work on JIRAs based on the priorities. If this JIRA is urgent to you, please provide the following information then I will escalate the JIRA for you
- To which I got the reply:
回答2:
For now you can resolve this writing an alternative select statement as in
Sql - alternative to WITH ... AS
It does not make sense and is very unlucky for Mule not to support CTE
来源:https://stackoverflow.com/questions/36142783/why-cant-i-use-a-cte-in-my-select-statement