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!

find the invoices po wise and non po wise

user11156570Nov 2 2011 — edited Nov 2 2011
hi guys i'm working on oracle 10g r2

my question is

i have 2 tables

ap_invoices_all
ap_invoice_lines_all
select invoice_id from ap_invoices_all where invoice_num = '1010'
output is

invoice_id
100
now query 2nd table

select * from ap_invoice_lines_all where invoice_id = 100
output is [assum jus 2 or 3 columns]

invoice_id-----------line_type------------po_header_id
100---------------------item-----------------400
100---------------------tax------------------null
100---------------------tax-------------------null
my question is i want to check if ap_invoice_lines_all have po_header_id in respect of invoice_id then it will be show in po_invoices categories

i have make a query like this

select * from ap_invoices_all i
where invoice_num = '1010'
and exists ( select 1 from ap_invoice_lines_all
where invoice_id = i.invoice_id and po_header_id is null)
above query also shows me the records why?? because ap_invoice_lines_all have 3 lines 2 have null in po_header_id columns ..

my simple question is i want jus checked in ap_invoice_lines_all table if po_header_id is not null in corresponding invoices then it shows me INVOICES PO_WISE otherwise it cant show in
INVOICES NON-PO-WISE

my this test case shows in both ways [INVOCIES PO WISE] and [INVOICES NON-PO WISE] . i want dat record shud be show in INVOICES PO WISE only .

help
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 30 2011
Added on Nov 2 2011
1 comment
836 views