Jump to content
We've recently updated our Privacy Statement, available here ×

Recursive Query


Recommended Posts

I need to write the recursive query to fetch the data in my select query.

but it was giving me error with that. I'm writing this query

WITH RECURSIVE all_reports AS (
        SELECT id, manager_user_id, user_group_id
        FROM users
        WHERE manager_user_id=4
          UNION ALL
        SELECT c.id, c.manager_user_id, c.user_group_id
        FROM all_reports ar, users c
        WHERE c.manager_user_id=ar.id
      )
 
is it possible to write the recursive query? if yes please suggest me what I'm doing wrong.
 
Thanks in advance
 
Link to comment
Share on other sites

  • 1 month later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I only got this working in version 6.1.0. You have to add With to the validation.properties file. By default it only allows select and call. So go to 

/{yourinstalldirectory}/jasperreports-server-cp-6.1.0/apache-tomcat/webapps/jasperserver/WEB-INF/classes/esapi

There you will find validation.properties file, search for Validator.ValidSQL= and add with where you see select and call. I use linux so I am not sure your platform. I also tried this in version 5.5.0 but couldn't get it to work. It works fine for me in the latest version and I use a lot of CTE queries now to build temp tables in db2 because it is easier that way than declaring temp tables.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...