[Home] [Help]
110:
111: CURSOR c_gir_links IS
112: select gir_rowid,
113: gl_sl_link_id
114: from cst_gl_summary_links_temp;
115:
116: TYPE gir_rowid_type IS TABLE OF cst_gl_summary_links_temp.gir_rowid%TYPE;
117: TYPE gl_sl_link_id_type IS TABLE OF cst_gl_summary_links_temp.gl_sl_link_id%TYPE;
118:
112: select gir_rowid,
113: gl_sl_link_id
114: from cst_gl_summary_links_temp;
115:
116: TYPE gir_rowid_type IS TABLE OF cst_gl_summary_links_temp.gir_rowid%TYPE;
117: TYPE gl_sl_link_id_type IS TABLE OF cst_gl_summary_links_temp.gl_sl_link_id%TYPE;
118:
119: gir_rowid_tab gir_rowid_type;
120: gl_sl_link_id_tab gl_sl_link_id_type;
113: gl_sl_link_id
114: from cst_gl_summary_links_temp;
115:
116: TYPE gir_rowid_type IS TABLE OF cst_gl_summary_links_temp.gir_rowid%TYPE;
117: TYPE gl_sl_link_id_type IS TABLE OF cst_gl_summary_links_temp.gl_sl_link_id%TYPE;
118:
119: gir_rowid_tab gir_rowid_type;
120: gl_sl_link_id_tab gl_sl_link_id_type;
121:
123: select /*+ ORDERED */
124: mta.rowid,
125: mta.inv_sub_ledger_id,
126: sl.gl_sl_link_id
127: from cst_gl_summary_links_temp sl,
128: mtl_transaction_accounts mta
129: where mta.gl_batch_id = sl.gl_batch_id
130: and mta.reference_account = sl.reference_account
131: and sl.gl_currency_code = nvl(mta.currency_code, sl.ledger_currency_code)
213: debug(' L'||l_count||': Deleted '||SQL%ROWCOUNT||' rows from GIR');
214:
215: l_stmnt_num := 20;
216: FORALL i in 1..je_header_id_tab.count
217: insert into cst_gl_summary_links_temp
218: ( je_header_id,
219: je_line_num,
220: gl_batch_id,
221: reference_account,
248: CLOSE c_gl_lines;
249: debug('
251: select count(*) into l_count
252: from cst_gl_summary_links_temp;
253:
254: IF l_count <> 0 THEN
255:
256: /* For the same
269:
270: debug(' >Validating data in SL');
271: l_stmnt_num := 30;
272: select count(*) into l_count
273: from cst_gl_summary_links_temp link1
274: where link1.gl_dr_cr_flag = 0
275: and exists ( select 1 from cst_gl_summary_links_temp link2
276: where link2.gl_batch_id = link1.gl_batch_id
277: and link2.reference_account = link1.reference_account
271: l_stmnt_num := 30;
272: select count(*) into l_count
273: from cst_gl_summary_links_temp link1
274: where link1.gl_dr_cr_flag = 0
275: and exists ( select 1 from cst_gl_summary_links_temp link2
276: where link2.gl_batch_id = link1.gl_batch_id
277: and link2.reference_account = link1.reference_account
278: and link2.gl_currency_code = link1.gl_currency_code
279: and link2.ussgl_transaction_code = link1.ussgl_transaction_code
280: and link2.gl_dr_cr_flag in (1,-1))
281: and rownum < 2;
282:
283: IF l_count > 0 THEN
284: debug(' Error validating data for cst_gl_summary_links_temp. l_count = '||l_count);
285: END IF;
286:
287: /* In the above table for the single row cases the gl_dr_cr_flag
288: should be updated to zero. Hence gl_dr_cr_flag for 2 & 3 should
288: should be updated to zero. Hence gl_dr_cr_flag for 2 & 3 should
289: be updated to zero */
290:
291: l_stmnt_num := 40;
292: update cst_gl_summary_links_temp link1
293: set link1. gl_dr_cr_flag = 0
294: where link1.gl_dr_cr_flag in (1,-1)
295: and not exists ( select 1 from cst_gl_summary_links_temp link2
296: where link1.gl_batch_id = link2.gl_batch_id
291: l_stmnt_num := 40;
292: update cst_gl_summary_links_temp link1
293: set link1. gl_dr_cr_flag = 0
294: where link1.gl_dr_cr_flag in (1,-1)
295: and not exists ( select 1 from cst_gl_summary_links_temp link2
296: where link1.gl_batch_id = link2.gl_batch_id
297: and link1.reference_account = link2.reference_account
298: and link1.gl_currency_code = link2.gl_currency_code
299: and link1.ussgl_transaction_code = link2.ussgl_transaction_code
451:
452: CURSOR c_gir_links IS
453: select gir_rowid,
454: gl_sl_link_id
455: from cst_gl_summary_links_temp;
456:
457: TYPE gir_rowid_type IS TABLE OF cst_gl_summary_links_temp.gir_rowid%TYPE;
458: TYPE gl_sl_link_id_type IS TABLE OF cst_gl_summary_links_temp.gl_sl_link_id%TYPE;
459:
453: select gir_rowid,
454: gl_sl_link_id
455: from cst_gl_summary_links_temp;
456:
457: TYPE gir_rowid_type IS TABLE OF cst_gl_summary_links_temp.gir_rowid%TYPE;
458: TYPE gl_sl_link_id_type IS TABLE OF cst_gl_summary_links_temp.gl_sl_link_id%TYPE;
459:
460: gir_rowid_tab gir_rowid_type;
461: gl_sl_link_id_tab gl_sl_link_id_type;
454: gl_sl_link_id
455: from cst_gl_summary_links_temp;
456:
457: TYPE gir_rowid_type IS TABLE OF cst_gl_summary_links_temp.gir_rowid%TYPE;
458: TYPE gl_sl_link_id_type IS TABLE OF cst_gl_summary_links_temp.gl_sl_link_id%TYPE;
459:
460: gir_rowid_tab gir_rowid_type;
461: gl_sl_link_id_tab gl_sl_link_id_type;
462:
464: select /*+ ORDERED */
465: wta.rowid,
466: wta.wip_sub_ledger_id,
467: sl.gl_sl_link_id
468: from cst_gl_summary_links_temp sl,
469: wip_transaction_accounts wta
470: where wta.gl_batch_id = sl.gl_batch_id
471: and wta.reference_account = sl.reference_account
472: and sl.gl_currency_code = nvl(wta.currency_code, sl.ledger_currency_code)
553: debug(' L'||l_count||': Deleted '||SQL%ROWCOUNT||' rows from GIR');
554:
555: l_stmnt_num := 20;
556: FORALL i in 1..je_header_id_tab.count
557: insert into cst_gl_summary_links_temp
558: ( je_header_id,
559: je_line_num,
560: gl_batch_id,
561: reference_account,
588: CLOSE c_gl_lines;
589: debug('
591: select count(*) into l_count
592: from cst_gl_summary_links_temp;
593:
594: IF l_count <> 0 THEN
595:
596: /* For the same
609:
610: debug(' >Validating data in SL');
611: l_stmnt_num := 30;
612: select count(*) into l_count
613: from cst_gl_summary_links_temp link1
614: where link1.gl_dr_cr_flag = 0
615: and exists ( select 1 from cst_gl_summary_links_temp link2
616: where link2.gl_batch_id = link1.gl_batch_id
617: and link2.reference_account = link1.reference_account
611: l_stmnt_num := 30;
612: select count(*) into l_count
613: from cst_gl_summary_links_temp link1
614: where link1.gl_dr_cr_flag = 0
615: and exists ( select 1 from cst_gl_summary_links_temp link2
616: where link2.gl_batch_id = link1.gl_batch_id
617: and link2.reference_account = link1.reference_account
618: and link2.gl_currency_code = link1.gl_currency_code
619: and link2.ussgl_transaction_code = link1.ussgl_transaction_code
620: and link2.gl_dr_cr_flag in (1,-1))
621: and rownum < 2;
622:
623: IF l_count > 0 THEN
624: debug(' Error validating data for cst_gl_summary_links_temp. l_count = '||l_count);
625: END IF;
626:
627: /* In the above table for the single row cases the gl_dr_cr_flag
628: should be updated to zero. Hence gl_dr_cr_flag for 2 & 3 should
628: should be updated to zero. Hence gl_dr_cr_flag for 2 & 3 should
629: be updated to zero */
630:
631: l_stmnt_num := 40;
632: update cst_gl_summary_links_temp link1
633: set link1. gl_dr_cr_flag = 0
634: where link1.gl_dr_cr_flag in (1,-1)
635: and not exists ( select 1 from cst_gl_summary_links_temp link2
636: where link1.gl_batch_id = link2.gl_batch_id
631: l_stmnt_num := 40;
632: update cst_gl_summary_links_temp link1
633: set link1. gl_dr_cr_flag = 0
634: where link1.gl_dr_cr_flag in (1,-1)
635: and not exists ( select 1 from cst_gl_summary_links_temp link2
636: where link1.gl_batch_id = link2.gl_batch_id
637: and link1.reference_account = link2.reference_account
638: and link1.gl_currency_code = link2.gl_currency_code
639: and link1.ussgl_transaction_code = link2.ussgl_transaction_code