Search code examples
oracle-databasejasper-reportsrownum

Jasper - Oracle - query result table is repeated


I cannot get a complex query for a table in jasper to return a single table. It repeats the resultant table the same number of times as the number of rows that are returned. With a simple query I could overcome this by using where rownum<=1.

With the following query, 'where rownum<=1' helps nothing (it gives me only one row as a result when there should be many and I still have multiple repeated tables):

SELECT column1, column2, column3, column4, column5 from the_table
WHERE (column1 like CONCAT ($P{column1},'%'))
AND (column2 like CONCAT ($P{column2},'%'))
AND (column3 like CONCAT ($P{column3},'%'))
AND (column4 like CONCAT ($P{column4},'%'))
AND (column5 like CONCAT ($P{column5},'%'))
AND rownum<=1
ORDER BY column4 DESC

I'd like only one table to be returned in my Jasper report - not as many as there are rows in the table.


Solution

  • AND rownum<=1 is correct. It must just be added in the main query - not a sub-dataset. :)