88: -- issue savepoint to restore deletes later
89: savepoint wictpg_sp;
90:
91: -- delete from table using dynamic SQL
92: x_cursor_id := dbms_sql.open_cursor;
93: dbms_sql.parse(x_cursor_id, p_delete_statement, dbms_sql.v7);
94: x_num_rows := dbms_sql.execute(x_cursor_id);
95: dbms_sql.close_cursor(x_cursor_id);
96:
89: savepoint wictpg_sp;
90:
91: -- delete from table using dynamic SQL
92: x_cursor_id := dbms_sql.open_cursor;
93: dbms_sql.parse(x_cursor_id, p_delete_statement, dbms_sql.v7);
94: x_num_rows := dbms_sql.execute(x_cursor_id);
95: dbms_sql.close_cursor(x_cursor_id);
96:
97: if (p_option = REPORT_ONLY) then
90:
91: -- delete from table using dynamic SQL
92: x_cursor_id := dbms_sql.open_cursor;
93: dbms_sql.parse(x_cursor_id, p_delete_statement, dbms_sql.v7);
94: x_num_rows := dbms_sql.execute(x_cursor_id);
95: dbms_sql.close_cursor(x_cursor_id);
96:
97: if (p_option = REPORT_ONLY) then
98: -- rollback deletes
91: -- delete from table using dynamic SQL
92: x_cursor_id := dbms_sql.open_cursor;
93: dbms_sql.parse(x_cursor_id, p_delete_statement, dbms_sql.v7);
94: x_num_rows := dbms_sql.execute(x_cursor_id);
95: dbms_sql.close_cursor(x_cursor_id);
96:
97: if (p_option = REPORT_ONLY) then
98: -- rollback deletes
99: rollback to wictpg_sp;
566: x_ret number := 0 ;
567: begin
568:
569:
570: x_cursor_id := dbms_sql.open_cursor;
571: dbms_sql.parse(x_cursor_id, p_sql, dbms_sql.v7);
572: dbms_sql.define_column(x_cursor_id, 1, x_count);
573: x_ret := dbms_sql.execute(x_cursor_id);
574: x_ret := dbms_sql.fetch_rows(x_cursor_id);
567: begin
568:
569:
570: x_cursor_id := dbms_sql.open_cursor;
571: dbms_sql.parse(x_cursor_id, p_sql, dbms_sql.v7);
572: dbms_sql.define_column(x_cursor_id, 1, x_count);
573: x_ret := dbms_sql.execute(x_cursor_id);
574: x_ret := dbms_sql.fetch_rows(x_cursor_id);
575: dbms_sql.column_value(x_cursor_id, 1, x_count);
568:
569:
570: x_cursor_id := dbms_sql.open_cursor;
571: dbms_sql.parse(x_cursor_id, p_sql, dbms_sql.v7);
572: dbms_sql.define_column(x_cursor_id, 1, x_count);
573: x_ret := dbms_sql.execute(x_cursor_id);
574: x_ret := dbms_sql.fetch_rows(x_cursor_id);
575: dbms_sql.column_value(x_cursor_id, 1, x_count);
576: dbms_sql.close_cursor(x_cursor_id);
569:
570: x_cursor_id := dbms_sql.open_cursor;
571: dbms_sql.parse(x_cursor_id, p_sql, dbms_sql.v7);
572: dbms_sql.define_column(x_cursor_id, 1, x_count);
573: x_ret := dbms_sql.execute(x_cursor_id);
574: x_ret := dbms_sql.fetch_rows(x_cursor_id);
575: dbms_sql.column_value(x_cursor_id, 1, x_count);
576: dbms_sql.close_cursor(x_cursor_id);
577:
570: x_cursor_id := dbms_sql.open_cursor;
571: dbms_sql.parse(x_cursor_id, p_sql, dbms_sql.v7);
572: dbms_sql.define_column(x_cursor_id, 1, x_count);
573: x_ret := dbms_sql.execute(x_cursor_id);
574: x_ret := dbms_sql.fetch_rows(x_cursor_id);
575: dbms_sql.column_value(x_cursor_id, 1, x_count);
576: dbms_sql.close_cursor(x_cursor_id);
577:
578: if (x_count > 0) then
571: dbms_sql.parse(x_cursor_id, p_sql, dbms_sql.v7);
572: dbms_sql.define_column(x_cursor_id, 1, x_count);
573: x_ret := dbms_sql.execute(x_cursor_id);
574: x_ret := dbms_sql.fetch_rows(x_cursor_id);
575: dbms_sql.column_value(x_cursor_id, 1, x_count);
576: dbms_sql.close_cursor(x_cursor_id);
577:
578: if (x_count > 0) then
579: p_rec_exists := TRUE ;
572: dbms_sql.define_column(x_cursor_id, 1, x_count);
573: x_ret := dbms_sql.execute(x_cursor_id);
574: x_ret := dbms_sql.fetch_rows(x_cursor_id);
575: dbms_sql.column_value(x_cursor_id, 1, x_count);
576: dbms_sql.close_cursor(x_cursor_id);
577:
578: if (x_count > 0) then
579: p_rec_exists := TRUE ;
580: append_report(p_purge_rec,p_option);
1014: x_ret number := 0 ;
1015: begin
1016:
1017:
1018: x_cursor_id := dbms_sql.open_cursor;
1019: dbms_sql.parse(x_cursor_id, p_sql, dbms_sql.v7);
1020: dbms_sql.define_column(x_cursor_id, 1, x_count);
1021: x_ret := dbms_sql.execute(x_cursor_id);
1022: x_ret := dbms_sql.fetch_rows(x_cursor_id);
1015: begin
1016:
1017:
1018: x_cursor_id := dbms_sql.open_cursor;
1019: dbms_sql.parse(x_cursor_id, p_sql, dbms_sql.v7);
1020: dbms_sql.define_column(x_cursor_id, 1, x_count);
1021: x_ret := dbms_sql.execute(x_cursor_id);
1022: x_ret := dbms_sql.fetch_rows(x_cursor_id);
1023: dbms_sql.column_value(x_cursor_id, 1, x_count);
1016:
1017:
1018: x_cursor_id := dbms_sql.open_cursor;
1019: dbms_sql.parse(x_cursor_id, p_sql, dbms_sql.v7);
1020: dbms_sql.define_column(x_cursor_id, 1, x_count);
1021: x_ret := dbms_sql.execute(x_cursor_id);
1022: x_ret := dbms_sql.fetch_rows(x_cursor_id);
1023: dbms_sql.column_value(x_cursor_id, 1, x_count);
1024: dbms_sql.close_cursor(x_cursor_id);
1017:
1018: x_cursor_id := dbms_sql.open_cursor;
1019: dbms_sql.parse(x_cursor_id, p_sql, dbms_sql.v7);
1020: dbms_sql.define_column(x_cursor_id, 1, x_count);
1021: x_ret := dbms_sql.execute(x_cursor_id);
1022: x_ret := dbms_sql.fetch_rows(x_cursor_id);
1023: dbms_sql.column_value(x_cursor_id, 1, x_count);
1024: dbms_sql.close_cursor(x_cursor_id);
1025:
1018: x_cursor_id := dbms_sql.open_cursor;
1019: dbms_sql.parse(x_cursor_id, p_sql, dbms_sql.v7);
1020: dbms_sql.define_column(x_cursor_id, 1, x_count);
1021: x_ret := dbms_sql.execute(x_cursor_id);
1022: x_ret := dbms_sql.fetch_rows(x_cursor_id);
1023: dbms_sql.column_value(x_cursor_id, 1, x_count);
1024: dbms_sql.close_cursor(x_cursor_id);
1025:
1026: -- set count of rows
1019: dbms_sql.parse(x_cursor_id, p_sql, dbms_sql.v7);
1020: dbms_sql.define_column(x_cursor_id, 1, x_count);
1021: x_ret := dbms_sql.execute(x_cursor_id);
1022: x_ret := dbms_sql.fetch_rows(x_cursor_id);
1023: dbms_sql.column_value(x_cursor_id, 1, x_count);
1024: dbms_sql.close_cursor(x_cursor_id);
1025:
1026: -- set count of rows
1027: p_rec_exists := p_rec_exists OR (x_count > 0);
1020: dbms_sql.define_column(x_cursor_id, 1, x_count);
1021: x_ret := dbms_sql.execute(x_cursor_id);
1022: x_ret := dbms_sql.fetch_rows(x_cursor_id);
1023: dbms_sql.column_value(x_cursor_id, 1, x_count);
1024: dbms_sql.close_cursor(x_cursor_id);
1025:
1026: -- set count of rows
1027: p_rec_exists := p_rec_exists OR (x_count > 0);
1028:
2384: ' and msi.base_item_id is null ' ||
2385: ' and msi.bom_item_type = 4 /*standard*/)) ';
2386: end if;
2387:
2388: x_cursor_id := dbms_sql.open_cursor;
2389: dbms_sql.parse(x_cursor_id, x_sql_stm1, dbms_sql.v7);
2390:
2391: /* Fix for bug#4902938 */
2392: if ( x_group_id is not null ) then
2385: ' and msi.bom_item_type = 4 /*standard*/)) ';
2386: end if;
2387:
2388: x_cursor_id := dbms_sql.open_cursor;
2389: dbms_sql.parse(x_cursor_id, x_sql_stm1, dbms_sql.v7);
2390:
2391: /* Fix for bug#4902938 */
2392: if ( x_group_id is not null ) then
2393: dbms_sql.bind_variable(x_cursor_id, ':l_group_id', x_group_id);
2389: dbms_sql.parse(x_cursor_id, x_sql_stm1, dbms_sql.v7);
2390:
2391: /* Fix for bug#4902938 */
2392: if ( x_group_id is not null ) then
2393: dbms_sql.bind_variable(x_cursor_id, ':l_group_id', x_group_id);
2394: end if;
2395: if ( to_char(p_org_id) is not null ) then
2396: dbms_sql.bind_variable(x_cursor_id, ':l_organization_id', to_char(p_org_id));
2397: end if;
2392: if ( x_group_id is not null ) then
2393: dbms_sql.bind_variable(x_cursor_id, ':l_group_id', x_group_id);
2394: end if;
2395: if ( to_char(p_org_id) is not null ) then
2396: dbms_sql.bind_variable(x_cursor_id, ':l_organization_id', to_char(p_org_id));
2397: end if;
2398:
2399: -- Bug 5129924
2400: -- Binding the values
2400: -- Binding the values
2401: -- ntungare
2402: --
2403: if (p_days_before_cutoff is not null ) then
2404: dbms_sql.bind_variable(x_cursor_id, ':l_from_date', x_from_date);
2405: end if;
2406:
2407: if ( p_cutoff_date is not null ) then
2408: dbms_sql.bind_variable(x_cursor_id, ':l_cutoff_date', p_cutoff_date);
2404: dbms_sql.bind_variable(x_cursor_id, ':l_from_date', x_from_date);
2405: end if;
2406:
2407: if ( p_cutoff_date is not null ) then
2408: dbms_sql.bind_variable(x_cursor_id, ':l_cutoff_date', p_cutoff_date);
2409: end if;
2410:
2411: /* END Fix for bug#4902938 */
2412:
2410:
2411: /* END Fix for bug#4902938 */
2412:
2413: if ( p_primary_item_id is not null ) then
2414: dbms_sql.bind_variable(x_cursor_id, ':l_primary_item_id', p_primary_item_id);
2415: end if;
2416: if ( p_from_job is not null ) then
2417: dbms_sql.bind_variable(x_cursor_id, ':l_from_job', p_from_job);
2418: end if;
2413: if ( p_primary_item_id is not null ) then
2414: dbms_sql.bind_variable(x_cursor_id, ':l_primary_item_id', p_primary_item_id);
2415: end if;
2416: if ( p_from_job is not null ) then
2417: dbms_sql.bind_variable(x_cursor_id, ':l_from_job', p_from_job);
2418: end if;
2419: if ( p_to_job is not null ) then
2420: dbms_sql.bind_variable(x_cursor_id, ':l_to_job', p_to_job);
2421: end if;
2416: if ( p_from_job is not null ) then
2417: dbms_sql.bind_variable(x_cursor_id, ':l_from_job', p_from_job);
2418: end if;
2419: if ( p_to_job is not null ) then
2420: dbms_sql.bind_variable(x_cursor_id, ':l_to_job', p_to_job);
2421: end if;
2422: x_num_rows := dbms_sql.execute(x_cursor_id);
2423: dbms_sql.close_cursor(x_cursor_id);
2424:
2418: end if;
2419: if ( p_to_job is not null ) then
2420: dbms_sql.bind_variable(x_cursor_id, ':l_to_job', p_to_job);
2421: end if;
2422: x_num_rows := dbms_sql.execute(x_cursor_id);
2423: dbms_sql.close_cursor(x_cursor_id);
2424:
2425: end if;
2426:
2419: if ( p_to_job is not null ) then
2420: dbms_sql.bind_variable(x_cursor_id, ':l_to_job', p_to_job);
2421: end if;
2422: x_num_rows := dbms_sql.execute(x_cursor_id);
2423: dbms_sql.close_cursor(x_cursor_id);
2424:
2425: end if;
2426:
2427: -- find schedules
2491: x_sql_stm2 := x_sql_stm2 || ' and wri.primary_item_id = :l_primary_item_id ';
2492: end if;
2493:
2494:
2495: x_cursor_id := dbms_sql.open_cursor;
2496: dbms_sql.parse(x_cursor_id, x_sql_stm2, dbms_sql.v7);
2497:
2498: /* Fix for bug#4902938 */
2499: if ( x_group_id is not null ) then
2492: end if;
2493:
2494:
2495: x_cursor_id := dbms_sql.open_cursor;
2496: dbms_sql.parse(x_cursor_id, x_sql_stm2, dbms_sql.v7);
2497:
2498: /* Fix for bug#4902938 */
2499: if ( x_group_id is not null ) then
2500: dbms_sql.bind_variable(x_cursor_id, ':l_group_id', x_group_id);
2496: dbms_sql.parse(x_cursor_id, x_sql_stm2, dbms_sql.v7);
2497:
2498: /* Fix for bug#4902938 */
2499: if ( x_group_id is not null ) then
2500: dbms_sql.bind_variable(x_cursor_id, ':l_group_id', x_group_id);
2501: end if;
2502: if ( to_char(p_org_id) is not null ) then
2503: dbms_sql.bind_variable(x_cursor_id, ':l_organization_id', to_char(p_org_id));
2504: end if;
2499: if ( x_group_id is not null ) then
2500: dbms_sql.bind_variable(x_cursor_id, ':l_group_id', x_group_id);
2501: end if;
2502: if ( to_char(p_org_id) is not null ) then
2503: dbms_sql.bind_variable(x_cursor_id, ':l_organization_id', to_char(p_org_id));
2504: end if;
2505:
2506: -- Bug 5129924
2507: -- Binding the values
2507: -- Binding the values
2508: -- ntungare
2509: --
2510: if ( p_days_before_cutoff is not null ) then
2511: dbms_sql.bind_variable(x_cursor_id, ':l_from_date', x_from_date);
2512: end if;
2513:
2514: if ( p_cutoff_date is not null ) then
2515: dbms_sql.bind_variable(x_cursor_id, ':l_cutoff_date', p_cutoff_date);
2511: dbms_sql.bind_variable(x_cursor_id, ':l_from_date', x_from_date);
2512: end if;
2513:
2514: if ( p_cutoff_date is not null ) then
2515: dbms_sql.bind_variable(x_cursor_id, ':l_cutoff_date', p_cutoff_date);
2516: end if;
2517: /* END Fix for bug#4902938 */
2518:
2519: if ( p_line_id is not null ) then
2516: end if;
2517: /* END Fix for bug#4902938 */
2518:
2519: if ( p_line_id is not null ) then
2520: dbms_sql.bind_variable(x_cursor_id, ':l_line_id', p_line_id);
2521: end if;
2522: if ( p_primary_item_id is not null ) then
2523: dbms_sql.bind_variable(x_cursor_id, ':l_primary_item_id', p_primary_item_id);
2524: end if;
2519: if ( p_line_id is not null ) then
2520: dbms_sql.bind_variable(x_cursor_id, ':l_line_id', p_line_id);
2521: end if;
2522: if ( p_primary_item_id is not null ) then
2523: dbms_sql.bind_variable(x_cursor_id, ':l_primary_item_id', p_primary_item_id);
2524: end if;
2525:
2526: x_num_rows := dbms_sql.execute(x_cursor_id);
2527: dbms_sql.close_cursor(x_cursor_id);
2522: if ( p_primary_item_id is not null ) then
2523: dbms_sql.bind_variable(x_cursor_id, ':l_primary_item_id', p_primary_item_id);
2524: end if;
2525:
2526: x_num_rows := dbms_sql.execute(x_cursor_id);
2527: dbms_sql.close_cursor(x_cursor_id);
2528:
2529:
2530: end if;
2523: dbms_sql.bind_variable(x_cursor_id, ':l_primary_item_id', p_primary_item_id);
2524: end if;
2525:
2526: x_num_rows := dbms_sql.execute(x_cursor_id);
2527: dbms_sql.close_cursor(x_cursor_id);
2528:
2529:
2530: end if;
2531: