on ‎2023 Apr 23 11:01 PM
I would like to loop over a table with 3 fields and use the value in column LOOKUP_1 in each row to create a hierarchy. The hierarchy consists of several rows. I want to append these rows to a 2nd table. Thus, if my 1st table has 30 rows, I want my 2nd table to contain 30 * "several" rows.
So the steps are as follow
Create hierarchy for 1st row in 1st table where LOOKUP_1 = A.
The code below will create several rows for 1 hierarchy with the top node = A.
Append these rows to 2nd table.
Repeat for 2nd row in until last row in 1st table.
I'm not sure how to append within a loop.
Any help would be appreciated.
select node_id, parent_id from hierarchy ( source ( select SRC as node_id
, TGT as parent_id
from RSBKDTP
)
start where TGT = A
)
;

<br>
Request clarification before answering.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.