Hey all,
In 8.1.7.2 on HP/UX, a developer has tables T1 and T2 in our manufacturing
(ERP) DB. T1 is a hierarchical bill-of-materials ("BOM") and T2 is the part
master. Of course, we need to recurse down T1, like this:
SELECT LEVEL, assembly, component, qty
FROM T1
START WITH assembly = 'ASSY01'
CONNECT BY PRIOR component = assembly;
...which works great to get us the exploded BOM. The problem is that we
don't want hierarchies in T2 whose "assembly" in T1 has "some_flag" set. In
syntactically-incorrect code, we want;
SELECT LEVEL, assembly, component, qty
FROM T1
START WITH assembly = 'ASSY01'
CONNECT BY PRIOR component = assembly
AND PRIOR component =
(SELECT partno
FROM T2
WHERE partno = PRIOR component
AND some_flag = 'Y')
The problem, of course, is that I can't connect the PRIOR component to a
table in the subquery.
Anyone have an idea? I can't move that subquery to be outside of the
CONNECT BY SELECT because the entire hierarchy below the component whose
"some_flag" != 'Y' needs to be ignored (i.e. subcomponents at lower levels
may have this flag set to 'Y', but because the parent's was not, we don't
want the subcomponents, either).
TIA!
Rich Jesse System/Database Administrator
[EMAIL PROTECTED] Quad/Tech International, Sussex, WI USA
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Jesse, Rich
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).