我有以下情况:我在流变量 destTable 中有一个表的名称,并希望将其放入简单查询中:
SELECT * FROM #[destTable]
我完全确定该表存在,调用查询的用户可以访问它,并且我的变量中的名称是正确的并且是字符串类型 - 我确信因为如果我明确输入表的名称,它一切正常。我得到的错误是:
Root Exception stack trace:
java.sql.SQLSyntaxErrorException: ORA-00903: invalid table name
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:457)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:400)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:926)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
该错误表明该名称无效,但正如我所说 - 我已经通过记录器等检查该名称(T_ORG)不包含空格或任何不可打印的字符。对于我遗漏了什么或做错了什么,或者可能是 Mule 软件本身的问题,我恳请您迅速做出回应?
附加信息 1:没有“#[]”的查询具有语法着色(主要是棕色和黑色);但是,如果我将 #[] 放在 FROM 子句之后,那么它之后的所有内容都会变成浅蓝色,就好像它是一个注释或以其他方式被忽略了一样。希望这有助于定位问题。
附加信息 2:重现错误的示例配置(假设您有 Oracle XE 等):
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml"
xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.3.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd ">
<jdbc-ee:connector name="Database" dataSource-ref="cdf" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database"/>
<jdbc-ee:oracle-data-source name="cdf" user="CDF" password="CDF" url="jdbc:oracle:thin:@//localhost:1521/xe" transactionIsolation="UNSPECIFIED" doc:name="Oracle Data Source"/>
<flow name="sampleFlow" doc:name="sampleFlow">
<http:inbound-endpoint exchange-pattern="one-way" host="localhost" port="8082" doc:name="HTTP"/>
<set-variable variableName="myVar" value="T_ORG" doc:name="Variable"/>
<jdbc-ee:outbound-endpoint exchange-pattern="one-way" queryKey="selectAll" queryTimeout="-1" connector-ref="Database" doc:name="Database">
<jdbc-ee:query key="selectAll" value="SELECT * FROM #[myVar]"/>
</jdbc-ee:outbound-endpoint>
</flow>
</mule>