Skip to Main Content

SQL Developer

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!

SQL not returning data in sql developer but does when ran in an sql session

Ruth DAug 25 2009 — edited Aug 26 2009
Hi Guys

Wonder if anyone can help. I am new to sql developer.

I am running in a peice of sql but am getting no results back. when i run it in an sql session on our server it works correctly. I am just wondering if i am doing somthing wrong. I am running the sql to get data from Oracle FMS and need to set the following data first in order to get the data from the tables.

begin
fnd_client_info.set_org_context(0);
end;

I then run the code
SELECT DISTINCT pti.attribute_value
,ph.segment1
,pti2.attribute_value
,gcc.segment3
,phc.hazard_class
,REPLACE(REPLACE(SUBSTR(pl.item_description, 1, 47),CHR(13),' '),CHR(10),' ')
,pl.unit_price
,DECODE(aid.invoice_id, aid.invoice_id, (SELECT ai.invoice_num
FROM ap_invoices ai
WHERE ai.INVOICE_ID = aid.invoice_id))
,DECODE(aid.batch_id, aid.batch_id, (SELECT ab.batch_name FROM ap_batches ab WHERE ab.batch_id = aid.batch_id))
,po.quantity_ordered
,po.quantity_delivered
,aid.quantity_invoiced
,DECODE ((SELECT DISTINCT 1
FROM ap_holds ah
WHERE ah.status_flag = 'S'
AND ah.invoice_id = aid.invoice_id
AND ah.line_location_id = po.line_location_id
AND po.po_line_id = pl.po_line_id
AND pl.line_num = aid.distribution_line_number ), '1', 'On Hold', NULL) hold
,(SELECT SUM(aid3.amount) FROM ap_invoice_distributions aid3 , ap_invoices ai3
WHERE aid3.po_distribution_id = aid.po_distribution_id
AND aid3.invoice_id = ai3.invoice_id
AND ai3.invoice_type_lookup_code = 'CREDIT') credit
FROM por_template_info pti
,por_template_info pti2
,por_template_attributes_tl pta
,por_template_attributes_tl pta2
,po_req_distributions pr
,po_distributions po
,po_headers ph
,po_lines pl
,po_hazard_classes phc
,gl_code_combinations gcc
,ap_invoice_distributions aid
,icx_category_lov icl
WHERE pti.attribute_code = pta.attribute_code
AND UPPER(pta.attribute_name) IN ('IT SERVICES RFS')
AND pti2.attribute_code = pta2.attribute_code
AND UPPER(pta2.attribute_name) IN ('IT CHARGE CENTRE INFO')
AND EXISTS (SELECT pti3.attribute_value
FROM por_template_info pti3
,por_template_attributes_tl pta3
WHERE UPPER(pti3.attribute_value) = 'YES'
AND pti3.requisition_line_id = pti.requisition_line_id
AND pti3.attribute_code = pta3.attribute_code
AND UPPER(pta3.attribute_name) IN ('LEASED ITEM'))
AND ph.segment1 NOT IN ('3000516', '3000528')
AND pti.requisition_line_id = pti2.requisition_line_id
AND pti.requisition_line_id = pr.requisition_line_id
AND pr.distribution_id = po.req_distribution_id
AND po.po_header_id = ph.po_header_id
AND ph.po_header_id = pl.po_header_id
AND ph.cancel_flag IS NULL
AND pl.cancel_flag IS NULL
AND pl.hazard_class_id = phc.hazard_class_id
AND po.code_combination_id = gcc.code_combination_id
AND pl.category_id = icl.category_id
AND po.po_distribution_id = aid.po_distribution_id (+)
AND po.po_line_id = pl.po_line_id
AND (aid.po_distribution_id IS NULL
OR
(EXISTS (SELECT DISTINCT 1
FROM po_headers ph2
,ap_invoice_distributions aid2
,ap_invoices ai2
,po_distributions po2
,po_lines pl2
WHERE ph2.segment1 = ph.segment1
AND ph2.po_header_id = po2.po_header_id
AND po2.po_distribution_id = aid2.po_distribution_id
AND aid2.invoice_id = ai2.invoice_id
AND ph2.cancel_flag IS NULL
AND pl2.cancel_flag IS NULL
AND ph2.po_header_id = pl2.po_header_id
AND pl2.po_line_id = po2.po_line_id
AND pl2.unit_price != 0
AND ( ai2.payment_status_flag != 'Y'
OR po2.quantity_ordered != po2.quantity_billed) ) )
OR
(EXISTS (SELECT 1
FROM po_headers ph3
,po_distributions po3
,po_lines pl3
WHERE ph3.po_header_id = po3.po_header_id
AND ph3.po_header_id = pl3.po_header_id
AND pl3.po_line_id = po3.po_line_id
AND ph3.segment1 = ph.segment1
AND ph3.cancel_flag IS NULL
AND pl3.cancel_flag IS NULL
AND po3.quantity_billed = 0
AND pl3.unit_price != 0 ) ) )
AND aid.reversal_flag (+) IS NULL
AND pl.unit_price != 0
AND (UPPER(icl.concatenated_segments) = ('INFORMATION TECHNOLOGY.DESKTOP HARDWARE.SLC')
OR UPPER(icl.concatenated_segments) = ('INFORMATION TECHNOLOGY.IT PERIPHERALS LEASE.SLC'))
ORDER BY ph.segment1, pti.attribute_value;

I get no rows back in SQL developer but 41 when i run the same queries from an sql session.

Can anyone help?

Regards
Ruth
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 23 2009
Added on Aug 25 2009
6 comments
1,532 views