Skip to Main Content

SQL & PL/SQL

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!

Hi all i am trying to use a Connect by prior clause

1760532Apr 25 2015 — edited Apr 25 2015

Hi all,

In my connect by prior clause i have a query. I want to pass the values to the query from my outer query. Can this be done in Oracle.Can any help me in this.Also Pasting my query for your reference

SELECT rct2.trx_number

     , rctl2.customer_trx_line_id

     , fifs.flex_value_set_id

     , gcc.code_combination_id

     , ffvc.child_flex_value

     , ffvc.parent_flex_value

     , gcc.segment4

     , ffvc.description

     , ffvc.lvl

FROM   ra_customer_trx_all rct2

      ,ra_customer_trx_lines_all rctl2

      ,ra_cust_trx_line_gl_dist_all rctlgd

      ,gl_code_combinations gcc

      , (SELECT     ffvv.flex_value_set_id

                  , ffvv.flex_value child_flex_value

                  , LEVEL lvl, ffvv.parent_flex_value

                  , ffvv.description

               FROM fnd_flex_value_children_v ffvv

              WHERE 1 = 1

              START WITH  ffvv.flex_value = (SELECT 

      gcc.segment4

  FROM ra_customer_trx_all rct1,

       ra_customer_trx_lines_all rctl1,

       ra_cust_trx_line_gl_dist_all rctlgd,

       gl_code_combinations gcc

WHERE rct1.customer_trx_id=rctl1.customer_trx_id

AND rctl1.customer_trx_line_id=rctlgd.customer_trx_line_id

AND  rct1.customer_trx_id=rctlgd.customer_trx_id

AND rctlgd.account_class = 'REV'

AND rctlgd.code_combination_id=gcc.code_combination_id

AND rct1.trx_number            = :trx_number--Want to pass  rct2.trx_number here which is coming from outer query

AND rctla.customer_trx_line_id = :trx_line_id)--Want to pass rctl2.customer_trx_line_id here which is coming from outer query

         CONNECT BY PRIOR ffvv.parent_flex_value = ffvv.flex_value  ) ffvc

      ,fnd_flex_value_sets s

      ,fnd_id_flex_segments fifs

      ,gl_ledgers l

WHERE rct2.customer_trx_id           = rctl2.customer_trx_id

   AND rctl2.customer_trx_line_id   = rctlgd.customer_trx_line_id

   AND rct2.customer_trx_id          = rctlgd.customer_trx_id

   AND rctlgd.code_combination_id   = gcc.code_combination_id

   AND fifs.flex_value_set_id       = ffvc.flex_value_set_id

   AND fifs.application_id          = 101

   AND fifs.flex_value_set_id       = s.flex_value_set_id

   AND fifs.application_column_name = 'SEGMENT4'

   AND fifs.id_flex_code            = 'GL#'

   AND l.chart_of_accounts_id       = fifs.id_flex_num

   AND l.ledger_id                  = rct2.set_of_books_id

   AND rctlgd.account_class         = 'REV'

   AND rctl2.customer_trx_line_id   = :trx_line_id --Pass Trx id

   AND rct2.trx_number              = :trx_number  --Pass trx number

This post has been answered by 1760532 on Apr 25 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 23 2015
Added on Apr 25 2015
3 comments
894 views