Pentaho CDE仪表板中SQL查询中列/表名的参数

时间:2018-04-12 10:55:16

标签: jdbc pentaho-cde

我正在尝试将列和表名的参数用于JNDY上的SQL查询,这不起作用,而值的参数工作正常。

我使用默认值定义了3个简单的参数组件:

paramTable = 'dummyTable'
paramColumn = 'dummyColumn'
paramValue = 'dummyValue'

然后我通过JNDI定义了一个SQL查询,如下所示:

select * from ${paramTable} where ${paramColumn} = ${paramValue};

...这不起作用,因为paramTable和paramColumn的参数值似乎没有正确应用,这会导致:

Caused by: java.sql.SQLSyntaxErrorException: ORA-00903: invalid table name

以下是一些查询修改,其结果让我失望:

select * from dummyTable where dummyColumn = ${paramValue}; 
-- works fine and delivers 1 row

select * from ${paramTable} where dummyColumn = 'dummyValue'; 
-- causes 'invalid table name' 

select * from dummyTable where ${paramColumn} = 'dummyValue'; 
-- does not cause any errors, but if I console.log() the result set of the query, 
   it is empty (1 row is expected though)

我错过了什么吗?

0 个答案:

没有答案