Basically, using $P!{param} is working via iReport Designer 5.6.0 . But then after I use the report in the Java application, errors occurs.
Heres how the query goes in the report:
SELECT t1.column1,
t2.column2,
t1.column3
$P!{selectParam}
FROM table1 t1
INNER JOIN table2 t2
ON t1.key = t2.key
$P!{leftJoinParam}
WHERE
...
GROUP BY ...
ORDER BY ...
Where
selectParam = " ,t3.column1, t3.column2, t3.column3 " <String>
And
leftJoinParam = " LEFT JOIN (
SELECT key, tmp1, tmp2, tmp3 FROM DUAL
UNION ALL
SELECT ..., ..., ..., ... FROM DUAL
UNION ALL
...
) t3 ON t3.key = t1.key " <String>
Value of leftJoinParam is passed by the Java app to the report wherein the SELECT...UNION ALL statement may vary in count of select depending on the data needed for the report.
It is confusing that the report is working alone in iReport Designer given some dummy parameter data with the desired output, but is not working in the Java app.
Here is the error in my the java app:
java.sql.SQLSyntaxErrorException: ORA-00923: FROM keyword not found where expected
Is there any other way so that I can use the SELECT...UNION ALL dynamically?
解决了。我的应用程序参数名称不等于我的报表参数名称。现在很明显,可以使用$ P!{...}动态修改整个报表SQL查询。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.