Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

Parameter for column / table names in SQL query in Pentaho CDE dashboard

$
0
0
Hello,

I'm trying to use parameters for column and table name to SQL query over JNDY, which doesn't work, while parameters for values work fine.

I defined 3 simple parameter components with default values:

Code:

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

Then I defined an SQL query over JNDI, that looks like:

Code:

select * from ${paramTable} where ${paramColumn} = ${paramValue};
... which does not work, because parameter values of paramTable and paramColumn don't seem to apply properly, which causes:
Code:

Caused by: java.sql.SQLSyntaxErrorException: ORA-00903: invalid table name
Here are some query modifications, and their results really disappoint me:

Code:

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)

Do I miss something?



I appreciate any help.

Viewing all articles
Browse latest Browse all 16689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>