126: BEGIN
127: IF PG_DEBUG in ('Y', 'C') THEN
128: msc_sch_wb.atp_debug('enable_trace: ' || 'Database Trace being enabled');
129: END IF;
130: C := DBMS_SQL.OPEN_CURSOR;
131: -- STATEMENT := 'ALTER SESSION SET SQL_TRACE=TRUE';
132: STATEMENT := 'ALTER SESSION SET events ' || '''' || '10046 trace name context forever, level 12' || '''' ;
133: DBMS_SQL.PARSE(C, STATEMENT, DBMS_SQL.NATIVE);
134: ROWS_PROCESSED := DBMS_SQL.EXECUTE(C);
129: END IF;
130: C := DBMS_SQL.OPEN_CURSOR;
131: -- STATEMENT := 'ALTER SESSION SET SQL_TRACE=TRUE';
132: STATEMENT := 'ALTER SESSION SET events ' || '''' || '10046 trace name context forever, level 12' || '''' ;
133: DBMS_SQL.PARSE(C, STATEMENT, DBMS_SQL.NATIVE);
134: ROWS_PROCESSED := DBMS_SQL.EXECUTE(C);
135: DBMS_SQL.CLOSE_CURSOR(C);
136: EXCEPTION
137: WHEN others THEN
130: C := DBMS_SQL.OPEN_CURSOR;
131: -- STATEMENT := 'ALTER SESSION SET SQL_TRACE=TRUE';
132: STATEMENT := 'ALTER SESSION SET events ' || '''' || '10046 trace name context forever, level 12' || '''' ;
133: DBMS_SQL.PARSE(C, STATEMENT, DBMS_SQL.NATIVE);
134: ROWS_PROCESSED := DBMS_SQL.EXECUTE(C);
135: DBMS_SQL.CLOSE_CURSOR(C);
136: EXCEPTION
137: WHEN others THEN
138: x_return_status :=-1;
131: -- STATEMENT := 'ALTER SESSION SET SQL_TRACE=TRUE';
132: STATEMENT := 'ALTER SESSION SET events ' || '''' || '10046 trace name context forever, level 12' || '''' ;
133: DBMS_SQL.PARSE(C, STATEMENT, DBMS_SQL.NATIVE);
134: ROWS_PROCESSED := DBMS_SQL.EXECUTE(C);
135: DBMS_SQL.CLOSE_CURSOR(C);
136: EXCEPTION
137: WHEN others THEN
138: x_return_status :=-1;
139: IF PG_DEBUG in ('Y', 'C') THEN
154: BEGIN
155: IF PG_DEBUG in ('Y', 'C') THEN
156: msc_sch_wb.atp_debug('disable_trace: ' || 'Database Trace disabled');
157: END IF;
158: C := DBMS_SQL.OPEN_CURSOR;
159: STATEMENT := 'ALTER SESSION SET SQL_TRACE=FALSE';
160: DBMS_SQL.PARSE(C, STATEMENT, DBMS_SQL.NATIVE);
161: ROWS_PROCESSED := DBMS_SQL.EXECUTE(C);
162: DBMS_SQL.CLOSE_CURSOR(C);
156: msc_sch_wb.atp_debug('disable_trace: ' || 'Database Trace disabled');
157: END IF;
158: C := DBMS_SQL.OPEN_CURSOR;
159: STATEMENT := 'ALTER SESSION SET SQL_TRACE=FALSE';
160: DBMS_SQL.PARSE(C, STATEMENT, DBMS_SQL.NATIVE);
161: ROWS_PROCESSED := DBMS_SQL.EXECUTE(C);
162: DBMS_SQL.CLOSE_CURSOR(C);
163: EXCEPTION
164: WHEN others THEN
157: END IF;
158: C := DBMS_SQL.OPEN_CURSOR;
159: STATEMENT := 'ALTER SESSION SET SQL_TRACE=FALSE';
160: DBMS_SQL.PARSE(C, STATEMENT, DBMS_SQL.NATIVE);
161: ROWS_PROCESSED := DBMS_SQL.EXECUTE(C);
162: DBMS_SQL.CLOSE_CURSOR(C);
163: EXCEPTION
164: WHEN others THEN
165: x_return_status :=-1;
158: C := DBMS_SQL.OPEN_CURSOR;
159: STATEMENT := 'ALTER SESSION SET SQL_TRACE=FALSE';
160: DBMS_SQL.PARSE(C, STATEMENT, DBMS_SQL.NATIVE);
161: ROWS_PROCESSED := DBMS_SQL.EXECUTE(C);
162: DBMS_SQL.CLOSE_CURSOR(C);
163: EXCEPTION
164: WHEN others THEN
165: x_return_status :=-1;
166: IF PG_DEBUG in ('Y', 'C') THEN
377: IF l_a2m_dblink IS NOT NULL THEN --bug3049003 changed from G_DB_PROFILE to l_a2m_dblink
378: IF PG_DEBUG in ('Y', 'C') THEN
379: msc_sch_wb.atp_debug('Call_ATP_Commit: ' || 'after commit, before closing DB Link');
380: END IF;
381: cursor_name := dbms_sql.open_cursor;
382: DBMS_SQL.PARSE(cursor_name, 'alter session close database link ' ||l_a2m_dblink, --bug3049003 changed from G_DB_PROFILE to l_a2m_dblink
383: dbms_sql.native);
384:
385: -- Added this block to handle the exception in case DB LInk wasn't open.
378: IF PG_DEBUG in ('Y', 'C') THEN
379: msc_sch_wb.atp_debug('Call_ATP_Commit: ' || 'after commit, before closing DB Link');
380: END IF;
381: cursor_name := dbms_sql.open_cursor;
382: DBMS_SQL.PARSE(cursor_name, 'alter session close database link ' ||l_a2m_dblink, --bug3049003 changed from G_DB_PROFILE to l_a2m_dblink
383: dbms_sql.native);
384:
385: -- Added this block to handle the exception in case DB LInk wasn't open.
386: -- If not handled, this causes ORA-02081.
379: msc_sch_wb.atp_debug('Call_ATP_Commit: ' || 'after commit, before closing DB Link');
380: END IF;
381: cursor_name := dbms_sql.open_cursor;
382: DBMS_SQL.PARSE(cursor_name, 'alter session close database link ' ||l_a2m_dblink, --bug3049003 changed from G_DB_PROFILE to l_a2m_dblink
383: dbms_sql.native);
384:
385: -- Added this block to handle the exception in case DB LInk wasn't open.
386: -- If not handled, this causes ORA-02081.
387: BEGIN
384:
385: -- Added this block to handle the exception in case DB LInk wasn't open.
386: -- If not handled, this causes ORA-02081.
387: BEGIN
388: rows_processed := dbms_sql.execute(cursor_name);
389: EXCEPTION
390: WHEN DBLINK_NOT_OPEN THEN
391: IF PG_DEBUG in ('Y', 'C') THEN
392: msc_sch_wb.atp_debug('Call_ATP_Commit: ' || 'inside DBLINK_NOT_OPEN');
392: msc_sch_wb.atp_debug('Call_ATP_Commit: ' || 'inside DBLINK_NOT_OPEN');
393: END IF;
394: END;
395:
396: DBMS_SQL.close_cursor(cursor_name);
397: IF PG_DEBUG in ('Y', 'C') THEN
398: msc_sch_wb.atp_debug('Call_ATP_Commit: ' || 'after commit, after closing DB Link');
399: END IF;
400: END IF;
434: -- finished by commit or rollback.
435: --l_db_profile := FND_PROFILE.value('MRP_ATP_DATABASE_LINK');
436: IF l_a2m_dblink IS NOT NULL THEN --bug3049003 changed from G_DB_PROFILE to l_a2m_dblink
437:
438: cursor_name := dbms_sql.open_cursor;
439: DBMS_SQL.PARSE(cursor_name, 'alter session close database link ' ||l_a2m_dblink, --bug3049003 changed from G_DB_PROFILE to l_a2m_dblink
440: dbms_sql.native);
441:
442: -- Added this block to handle the exception in case DB LInk wasn't open.
435: --l_db_profile := FND_PROFILE.value('MRP_ATP_DATABASE_LINK');
436: IF l_a2m_dblink IS NOT NULL THEN --bug3049003 changed from G_DB_PROFILE to l_a2m_dblink
437:
438: cursor_name := dbms_sql.open_cursor;
439: DBMS_SQL.PARSE(cursor_name, 'alter session close database link ' ||l_a2m_dblink, --bug3049003 changed from G_DB_PROFILE to l_a2m_dblink
440: dbms_sql.native);
441:
442: -- Added this block to handle the exception in case DB LInk wasn't open.
443: -- If not handled, this causes ORA-02081.
436: IF l_a2m_dblink IS NOT NULL THEN --bug3049003 changed from G_DB_PROFILE to l_a2m_dblink
437:
438: cursor_name := dbms_sql.open_cursor;
439: DBMS_SQL.PARSE(cursor_name, 'alter session close database link ' ||l_a2m_dblink, --bug3049003 changed from G_DB_PROFILE to l_a2m_dblink
440: dbms_sql.native);
441:
442: -- Added this block to handle the exception in case DB LInk wasn't open.
443: -- If not handled, this causes ORA-02081.
444: BEGIN
441:
442: -- Added this block to handle the exception in case DB LInk wasn't open.
443: -- If not handled, this causes ORA-02081.
444: BEGIN
445: rows_processed := dbms_sql.execute(cursor_name);
446: EXCEPTION
447: WHEN DBLINK_NOT_OPEN THEN
448: IF PG_DEBUG in ('Y', 'C') THEN
449: msc_sch_wb.atp_debug('Call_ATP_Commit: ' || 'inside DBLINK_NOT_OPEN exception');
449: msc_sch_wb.atp_debug('Call_ATP_Commit: ' || 'inside DBLINK_NOT_OPEN exception');
450: END IF;
451: END;
452:
453: DBMS_SQL.close_cursor(cursor_name);
454: IF PG_DEBUG in ('Y', 'C') THEN
455: msc_sch_wb.atp_debug('Call_ATP_Commit: ' || 'after rollback, after closing DB Link');
456: END IF;
457: END IF;
666: IF l_a2m_dblink IS NOT NULL THEN
667: IF PG_DEBUG in ('Y', 'C') THEN
668: msc_sch_wb.atp_debug(' before closing DB Link');
669: END IF;
670: cursor_name := dbms_sql.open_cursor;
671: DBMS_SQL.PARSE(cursor_name, 'alter session close database link ' ||l_a2m_dblink,
672: dbms_sql.native);
673: -- Added this block to handle the exception in case DB LInk wasn't open.
674: -- If not handled, this causes ORA-02081.
667: IF PG_DEBUG in ('Y', 'C') THEN
668: msc_sch_wb.atp_debug(' before closing DB Link');
669: END IF;
670: cursor_name := dbms_sql.open_cursor;
671: DBMS_SQL.PARSE(cursor_name, 'alter session close database link ' ||l_a2m_dblink,
672: dbms_sql.native);
673: -- Added this block to handle the exception in case DB LInk wasn't open.
674: -- If not handled, this causes ORA-02081.
675: BEGIN
668: msc_sch_wb.atp_debug(' before closing DB Link');
669: END IF;
670: cursor_name := dbms_sql.open_cursor;
671: DBMS_SQL.PARSE(cursor_name, 'alter session close database link ' ||l_a2m_dblink,
672: dbms_sql.native);
673: -- Added this block to handle the exception in case DB LInk wasn't open.
674: -- If not handled, this causes ORA-02081.
675: BEGIN
676: rows_processed := dbms_sql.execute(cursor_name);
672: dbms_sql.native);
673: -- Added this block to handle the exception in case DB LInk wasn't open.
674: -- If not handled, this causes ORA-02081.
675: BEGIN
676: rows_processed := dbms_sql.execute(cursor_name);
677: EXCEPTION
678: WHEN DBLINK_NOT_OPEN THEN
679: IF PG_DEBUG in ('Y', 'C') THEN
680: msc_sch_wb.atp_debug('inside DBLINK_NOT_OPEN');
679: IF PG_DEBUG in ('Y', 'C') THEN
680: msc_sch_wb.atp_debug('inside DBLINK_NOT_OPEN');
681: END IF;
682: END;
683: DBMS_SQL.close_cursor(cursor_name);
684: IF PG_DEBUG in ('Y', 'C') THEN
685: msc_sch_wb.atp_debug('after commit, after closing DB Link');
686: END IF;
687: END IF;
824: IF PG_DEBUG in ('Y', 'C') THEN
825: msc_sch_wb.atp_debug('after rollback, before closing DB Link');
826: END IF;
827: IF l_a2m_dblink IS NOT NULL THEN
828: cursor_name := dbms_sql.open_cursor;
829: DBMS_SQL.PARSE(cursor_name, 'alter session close database link ' ||l_a2m_dblink,
830: dbms_sql.native);
831: BEGIN
832: rows_processed := dbms_sql.execute(cursor_name);
825: msc_sch_wb.atp_debug('after rollback, before closing DB Link');
826: END IF;
827: IF l_a2m_dblink IS NOT NULL THEN
828: cursor_name := dbms_sql.open_cursor;
829: DBMS_SQL.PARSE(cursor_name, 'alter session close database link ' ||l_a2m_dblink,
830: dbms_sql.native);
831: BEGIN
832: rows_processed := dbms_sql.execute(cursor_name);
833: EXCEPTION
826: END IF;
827: IF l_a2m_dblink IS NOT NULL THEN
828: cursor_name := dbms_sql.open_cursor;
829: DBMS_SQL.PARSE(cursor_name, 'alter session close database link ' ||l_a2m_dblink,
830: dbms_sql.native);
831: BEGIN
832: rows_processed := dbms_sql.execute(cursor_name);
833: EXCEPTION
834: WHEN DBLINK_NOT_OPEN THEN
828: cursor_name := dbms_sql.open_cursor;
829: DBMS_SQL.PARSE(cursor_name, 'alter session close database link ' ||l_a2m_dblink,
830: dbms_sql.native);
831: BEGIN
832: rows_processed := dbms_sql.execute(cursor_name);
833: EXCEPTION
834: WHEN DBLINK_NOT_OPEN THEN
835: IF PG_DEBUG in ('Y', 'C') THEN
836: msc_sch_wb.atp_debug('inside DBLINK_NOT_OPEN exception');
835: IF PG_DEBUG in ('Y', 'C') THEN
836: msc_sch_wb.atp_debug('inside DBLINK_NOT_OPEN exception');
837: END IF;
838: END;
839: DBMS_SQL.close_cursor(cursor_name);
840: IF PG_DEBUG in ('Y', 'C') THEN
841: msc_sch_wb.atp_debug('after rollback, after closing DB Link');
842: END IF;
843: END IF;