** This thread discusses the article: TechTip: DB2's CONNECT BY Simplifies Recursive Processing **
I have a bill or materials file. Simplified, it has parent, child and quantity, where quantify is the number of units of child in a parent. A hypothetical set of records might look like this:
Parent Child Qty
PALLET CASE 20
CASE BOX 2
BOX UNIT 5
Starting with UNIT, I need to work backwards and calculate how many UNITs there are on a PALLET. In this example, there are 200 units on a pallet.
I have done this the “hard” way by coding my own recursive CTE. But can it be done using the new simplified CONNECT BY?
I had a look at the V7R1 SQL reference manual and the closest thing I could find was the SYS_CONNECT_BY_PATH function, but that does not work with numbers.
I have a bill or materials file. Simplified, it has parent, child and quantity, where quantify is the number of units of child in a parent. A hypothetical set of records might look like this:
Parent Child Qty
PALLET CASE 20
CASE BOX 2
BOX UNIT 5
Starting with UNIT, I need to work backwards and calculate how many UNITs there are on a PALLET. In this example, there are 200 units on a pallet.
I have done this the “hard” way by coding my own recursive CTE. But can it be done using the new simplified CONNECT BY?
I had a look at the V7R1 SQL reference manual and the closest thing I could find was the SYS_CONNECT_BY_PATH function, but that does not work with numbers.