40: id.last_updated_by,
41: i.cancelled_date
42: FROM
43: ap_invoices_all i,
44: ap_invoice_distributions_all id,
45: po_distributions_all pd,
46: cpg_oragems_mapping map,
47: po_lines_all pl,
48: mtl_system_items msi,
107: id.last_updated_by,
108: i.cancelled_date
109: FROM
110: ap_invoices_all i,
111: ap_invoice_distributions_all id,
112: po_distributions_all pd,
113: cpg_oragems_mapping map,
114: po_lines_all pl,
115: mtl_system_items msi,
347: IF invoiceid IS NOT NULL THEN
348: select min(decode(match_status_flag, 'N', '1N', 'T', '2T',
349: 'A', '3A', '4'))
350: into t_match_status_flag
351: from ap_invoice_distributions_all
352: where invoice_id = invoiceid;
353: ELSE
354: /* Bug 2539636 : This condition never occurs. Also, this sql is the top one
355: performance repository.
355: performance repository.
356: select min(decode(match_status_flag, 'N', '1N', 'T', '2T',
357: 'A', '3A', '4'))
358: into t_match_status_flag
359: from ap_invoice_distributions_all;
360: */
361: NULL;
362: END IF;
363:
364: BEGIN
365: IF invoiceid IS NOT NULL THEN
366: select distinct '1N' /* Need just one value ONLY (if it exist)!!! */
367: into t_match_status_flag2
368: from ap_invoice_distributions_all
369: where invoice_id = invoiceid
370: and match_status_flag is null
371: and exists (select 'There are tested and untested lines'
372: from ap_invoice_distributions_all
368: from ap_invoice_distributions_all
369: where invoice_id = invoiceid
370: and match_status_flag is null
371: and exists (select 'There are tested and untested lines'
372: from ap_invoice_distributions_all
373: where invoice_id = invoiceid
374: and match_status_flag in ('T', 'A'));
375: ELSE
376: /* Bug 2539636 : This condition never occurs. Also, this sql is the top one
376: /* Bug 2539636 : This condition never occurs. Also, this sql is the top one
377: performance repository.
378: select distinct '1N' Need just one value ONLY (if it exist)!!!
379: into t_match_status_flag2
380: from ap_invoice_distributions_all
381: where match_status_flag is null
382: and exists (select 'There are tested and untested lines'
383: from ap_invoice_distributions_all
384: where match_status_flag in ('T', 'A')
379: into t_match_status_flag2
380: from ap_invoice_distributions_all
381: where match_status_flag is null
382: and exists (select 'There are tested and untested lines'
383: from ap_invoice_distributions_all
384: where match_status_flag in ('T', 'A')
385: and rownum < 2);
386: */
387: NULL;