Archives of the TeradataForum
Message Posted: Fri, 19 Nov 2004 @ 10:52:21 GMT
Can we write recursive queries in Teradata.
I have a requirement wherein I need to display Hierarchy tree for a supervisor.
The table would have 2 fields empid and supervisor Id:-
Employee-Id Supervisor-id 1 --- 2 1 3 2 4 2 5 4 6 4
I want it to be implemented in a single query ..
Below is a pseudocode for recursive solution to same:-
DisplayTree(Supervisor_id) ( If emp_id not in ( supervisor's list) display empid exit Else Display empid CALL displayTree(emp_id) End if )
Thanks and Regards,
|Copyright 2016 - All Rights Reserved|
|Last Modified: 28 Jun 2020|