Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL looping

Re: SQL looping

From: Vladimir M. Zakharychev <vladimir.zakharychev_at_gmail.com>
Date: 22 Sep 2006 04:02:04 -0700
Message-ID: <1158922924.834990.71100@d34g2000cwd.googlegroups.com>

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US