Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

recursive/hierarchical query

Hello,
I've searched, but have not found the definitive answer. Can you tell me, is it possible to create a query or loop in Talend to return the results of a hierarchical query? This is the case where you have a table with a foreign key pointing to itself. It may be N levels deep. The table might look like:
Employee
---------------------------
employee#|manager#
1 2
2 3
3 null
where manager# points back to employee#. Oracle uses a "connect by" syntax for this. I am using JDBC
Labels (3)
4 Replies
Anonymous
Not applicable
Author

Hi
Try to use tOracleRow and edit sql with "connect by".
Check "Propagate QUERY's recordset" of tOracleRow->Advanced Settings.
Then pass the RecordSet to tParseRecordSet component.
Use tParseRecordSet to retrieve columns.
Regards,
Pedro
Anonymous
Not applicable
Author

Sorry, I should have been more clear. I am not using Oracle, that was just an example of what I am trying to do. Is there a way in Talend to do this, either with Talend objects, or with a Loop?
Anonymous
Not applicable
Author

I need the same thing.  I want to implement the recursive operation in Talend, not the Database.  Basically, I want to start at the leaf (employee) and add manager rows until the top node is reached.  
For those of you familiar with CTE in MS SQL server, I want to implement the same basic functionality using talend objects.
Anonymous
Not applicable
Author

I believe that a tutorial I have put together may help (with a working example for v5.5.1). It emulates the Oracle "Connect By" functionality using Talend components. You can find the tutorial here.