Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL looping
kacheek wrote:
> hello,
>
> I'm have some problems as i can abstract the correct data from the
> database. I need some of ur guidance here. So, here's the situation.
>
> for example, i have 5 different types of products, a-e. product a is
> made out of b and c. and product b is made out of d and e. means a = b
> ( is = d, e) and c. the way to different shade if the product has
> sub-products is based on field_x = 'Y'. if the particular product is
> not made out of another product/s then it is field_x = 'N'
>
> here's part of my codings.
>
> select a.name
> from tbl_product a, tbl_product_bom b
> where b.p_bom_id = a.p_id
> and a.field_x= 'N' // this shows all the products without
> subproducts
>
> select a.name
> from tbl_product a, tbl_product_bom b
> where b.p_bom_id = a.p_id
> and a.field_x= 'Y' // this shows all the products with
> subproducts
>
> so how am i going to loop the sql to actually get the information like
> product a is made out of b and c. and product b is made out of d and e??
Research hierachical queries and CONNECT BY in SQL Reference for your Oracle release.
Hth,
Vladimir M. Zakharychev
N-Networks, makers of Dynamic PSP(tm)
http://www.dynamicpsp.com
Received on Fri Sep 22 2006 - 06:02:04 CDT
![]() |
![]() |