Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dynamic Tree

451211Sep 27 2005 — edited Sep 28 2005
Hi. I'm hoping someone can tell me how I can create a dynamic tree. I have a very complicated SELECT statement to create my tree. If I try to just drop my SELECT statement into my tree definition, when trying to build my tree, my page loads for several minutes before timing out. So to get around this problem, I need to create a view or a table (which I've done and it works) to create my tree from. Once I create a table or view, I can use that as my tree structure and it works great.

So anyway, my problem is that my complicated SELECT statement (below) is hard-coded to "271962". I need to change that to :P1_ITEM, but I get the error:

ORA-01027: bind variables not allowed for data definition operations

Basically, I have a LOV of possible values that I want to pass to my Tree, so the "271962" below could be one of 100 or so different values.

My SQL Statement:

CREATE TABLE treedata (id, pid, name) as
SELECT
id_pid.component_item_id id,
id_pid.assembly_item_id pid,
trim(to_char(round(item_cost_sum, 2),'999990.99')) || '.....' ||
trim(to_char(round(1.47 * round(item_cost_sum),2),'999990.99')) || '.....' ||
msi.description name
from
(
SELECT DISTINCT bic.component_item_id, bbm.assembly_item_id
FROM bom_structures_b bbm, bom_components_b bic
WHERE bbm.bill_Sequence_id = bic.bill_sequence_id
AND bbm.organization_id = 85
CONNECT BY PRIOR bic.component_item_id = bbm.assembly_item_id
START WITH bbm.assembly_item_id = 271962
) id_pid
INNER JOIN MTL_SYSTEM_ITEMS_B msi
ON msi.inventory_item_id = id_pid.component_item_id
INNER JOIN
(
SELECT
INVENTORY_ITEM_ID,
ORGANIZATION_ID,
SUM(item_cost) item_cost_sum
FROM cst_item_cost_details cst
WHERE cst.cost_type_id = 1
GROUP BY
INVENTORY_ITEM_ID,
ORGANIZATION_ID
) cst
ON cst.INVENTORY_ITEM_ID = msi.inventory_item_id
AND cst.ORGANIZATION_ID = msi.organization_id
WHERE msi.ORGANIZATION_ID = 85
UNION ALL
SELECT
271962,
0,
trim(to_char(round(sum(cst2.item_cost),2), '999990.99')) || '.....' ||
trim(to_char(round(1.47 * round(sum(cst2.item_cost),2),2),'999990.99')) || '.....' ||
mtl2.DESCRIPTION
FROM mtl_system_items_b mtl2,
cst_item_cost_details cst2
WHERE mtl2.inventory_item_id = 271962
and mtl2.organization_id = 85
and cst2.inventory_item_id = mtl2.inventory_item_id
and cst2.organization_id = 85
and cst2.cost_type_id = 1
GROUP BY mtl2.description;

Thanks so much for any help!
Steve
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 26 2005
Added on Sep 27 2005
3 comments
704 views