77:
78: TYPE rounding_tbl_type IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
79:
80: TYPE lines_output_id_tbl_type
81: IS TABLE OF cn_sca_lines_output.sca_lines_output_id%TYPE;
82:
83: TYPE sca_winners_tbl_rec_type IS RECORD (
84: interface_id_tbl interface_id_tbl_type,
85: credit_rule_id_tbl credit_rule_id_tbl_type,
103: MAX(w.sca_credit_rule_id) sca_credit_rule_id,
104: DECODE(SUM(NVL(l.allocation_percentage,0)),100,'ALLOCATED','REV NOT 100')
105: process_status
106: FROM cn_sca_winners w,
107: cn_sca_lines_output l
108: WHERE w.sca_headers_interface_id = l.sca_headers_interface_id
109: AND w.sca_headers_interface_id BETWEEN l_start_id AND l_end_id
110: AND w.role_id = l.role_id
111: AND l.revenue_type = 'REVENUE'
300: RAISE;
301: END;
302:
303: --+
304: --+ Before populating records into cn_sca_lines_output table check whether
305: --+ transactions exists with same header_id and delete them.
306: --+
307:
308: DELETE cn_sca_lines_output a
304: --+ Before populating records into cn_sca_lines_output table check whether
305: --+ transactions exists with same header_id and delete them.
306: --+
307:
308: DELETE cn_sca_lines_output a
309: WHERE a.sca_headers_interface_id BETWEEN l_start_id AND l_end_id;
310:
311: debugmsg('Process Batch Rules: Trx deleted from cn_sca_lines_output :'||SQL%ROWCOUNT);
312:
307:
308: DELETE cn_sca_lines_output a
309: WHERE a.sca_headers_interface_id BETWEEN l_start_id AND l_end_id;
310:
311: debugmsg('Process Batch Rules: Trx deleted from cn_sca_lines_output :'||SQL%ROWCOUNT);
312:
313: COMMIT WORK;
314:
315: --+
312:
313: COMMIT WORK;
314:
315: --+
316: --+ Populate the data into cn_sca_lines_output table based on the rev and
317: --+ non-revenue type.
318: --+
319:
320: debugmsg('Process Batch Rules: Inserting Records Into cn_sca_lines_output');
316: --+ Populate the data into cn_sca_lines_output table based on the rev and
317: --+ non-revenue type.
318: --+
319:
320: debugmsg('Process Batch Rules: Inserting Records Into cn_sca_lines_output');
321:
322: l_output_sql :=
323: 'INSERT /*+ APPEND */ INTO cn_sca_lines_output( '||
324: ' sca_lines_output_id, '||
319:
320: debugmsg('Process Batch Rules: Inserting Records Into cn_sca_lines_output');
321:
322: l_output_sql :=
323: 'INSERT /*+ APPEND */ INTO cn_sca_lines_output( '||
324: ' sca_lines_output_id, '||
325: ' sca_headers_interface_id, '||
326: ' source_trx_id, '||
327: ' resource_id, '||
334: ' last_updated_by, '||
335: ' last_update_date, '||
336: ' last_update_login, '||
337: ' org_id) '||
338: 'SELECT cn_sca_lines_output_s.NEXTVAL, '||
339: ' sca_headers_interface_id, '||
340: ' source_trx_id, '||
341: ' resource_id, '||
342: ' role_id, '||
400: IN p_org_id,
401: IN l_start_id,
402: IN l_end_id;
403:
404: debugmsg('Process Batch Rules: Executed cn_sca_lines_output dynamic SQL');
405: debugmsg('Process Batch Rules: Records in cn_sca_lines_output :'||SQL%ROWCOUNT);
406:
407: COMMIT WORK;
408:
401: IN l_start_id,
402: IN l_end_id;
403:
404: debugmsg('Process Batch Rules: Executed cn_sca_lines_output dynamic SQL');
405: debugmsg('Process Batch Rules: Records in cn_sca_lines_output :'||SQL%ROWCOUNT);
406:
407: COMMIT WORK;
408:
409: EXCEPTION
407: COMMIT WORK;
408:
409: EXCEPTION
410: WHEN OTHERS THEN
411: debugmsg('Process Batch Rules: Error while inserting into cn_sca_lines_output'||SQLERRM);
412: RAISE;
413: END;
414:
415: --+