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!

single query for projec order and non project orders

Kumar62Jul 30 2009 — edited Jul 30 2009
Hello All,

I need a single query to track projectorders and non-project order. Actually an order can be project order or non project order. It it is a project order Budgets will be created (tables used for budgets are pa_budget_versions bv ,pa_budget_types bt ,pa_budget_lines_v bl).

select l.* from
oe_order_headers_All o,
oe_order_lines_all l,
pa_projects p,
pa_tasks pt,
OE_TRANSACTION_TYPES_ALL t
where o.header_id=l.header_id
and to_char(p.segment1(+))=to_char(o.order_number)
and pt.task_id(+)=l.line_id
and t.transaction_type_id=o.order_type_id
and o.header_id=34621

The above order is non project order. So no budgets information is presnt.

But in genric case(projrct and non project orders) i need to use budget tables as well in order to get the data.


So if i use below tables in the and conditions in the above query i wont get the data if the order is non-project.

From apps.pa_budget_versions bv ,
apps.pa_budget_types bt ,
apps.pa_budget_lines_v bl
where
AND bv.budget_version_id =bl.budget_version_id
AND bv.project_id =pt.project_id
AND bl.task_id =pt.task_id
AND bv.current_flag ='Y'
AND bv.budget_status_code='B'


How do we write a single query in order to get the projects as well as non projects data.

Kind Regards,
Kumar.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 27 2009
Added on Jul 30 2009
3 comments
2,141 views