535: BEGIN /* PL-SQL Block for doing the dynamic SQL part*/
536:
537: ff_statement_temp := NULL;
538: ff_err_temp := NULL;
539: DSQL_ff_c := dbms_sql.open_cursor;
540: dummy_ret_code := INVPUTLI.get_dynamic_sql_str(1, ff_statement_temp, ff_err_temp);
541:
542: /* Now append the sql statement to the generated dynamic sql where clause
543: ** NP 02MAY96 Added xset_id and a i
553: and exists (select null
554: from mtl_system_items_b msi
555: where msii.organization_id = msi.organization_id and ' || ff_statement_temp || ')';
556:
557: dbms_sql.parse(DSQL_ff_c, DSQL_ff_statement, dbms_sql.native);
558: dbms_sql.define_column(DSQL_ff_c,1,DSQL_ff_transaction_id);
559: dbms_sql.bind_variable(DSQL_ff_c, 'set_id_bind', xset_id);
560:
561: DSQL_ff_rows_processed := dbms_sql.execute(DSQL_ff_c);
554: from mtl_system_items_b msi
555: where msii.organization_id = msi.organization_id and ' || ff_statement_temp || ')';
556:
557: dbms_sql.parse(DSQL_ff_c, DSQL_ff_statement, dbms_sql.native);
558: dbms_sql.define_column(DSQL_ff_c,1,DSQL_ff_transaction_id);
559: dbms_sql.bind_variable(DSQL_ff_c, 'set_id_bind', xset_id);
560:
561: DSQL_ff_rows_processed := dbms_sql.execute(DSQL_ff_c);
562:
555: where msii.organization_id = msi.organization_id and ' || ff_statement_temp || ')';
556:
557: dbms_sql.parse(DSQL_ff_c, DSQL_ff_statement, dbms_sql.native);
558: dbms_sql.define_column(DSQL_ff_c,1,DSQL_ff_transaction_id);
559: dbms_sql.bind_variable(DSQL_ff_c, 'set_id_bind', xset_id);
560:
561: DSQL_ff_rows_processed := dbms_sql.execute(DSQL_ff_c);
562:
563: IF l_inv_debug_level IN(101, 102) THEN
557: dbms_sql.parse(DSQL_ff_c, DSQL_ff_statement, dbms_sql.native);
558: dbms_sql.define_column(DSQL_ff_c,1,DSQL_ff_transaction_id);
559: dbms_sql.bind_variable(DSQL_ff_c, 'set_id_bind', xset_id);
560:
561: DSQL_ff_rows_processed := dbms_sql.execute(DSQL_ff_c);
562:
563: IF l_inv_debug_level IN(101, 102) THEN
564: INVPUTLI.info('INVPAGI2: About to enter DSQL loop');
565: END IF;
564: INVPUTLI.info('INVPAGI2: About to enter DSQL loop');
565: END IF;
566:
567: loop
568: if dbms_sql.fetch_rows(DSQL_ff_c) > 0 then
569: dbms_sql.column_value(DSQL_ff_c,1,DSQL_ff_transaction_id);
570: dumm_status := INVPUOPI.mtl_log_interface_err(
571: -1,
572: user_id,
565: END IF;
566:
567: loop
568: if dbms_sql.fetch_rows(DSQL_ff_c) > 0 then
569: dbms_sql.column_value(DSQL_ff_c,1,DSQL_ff_transaction_id);
570: dumm_status := INVPUOPI.mtl_log_interface_err(
571: -1,
572: user_id,
573: login_id,
589: where transaction_id = DSQL_ff_transaction_id
590: and set_process_id = nvl(xset_id, set_process_id);
591: else
592: -- no more rows, Close cursor and exit
593: dbms_sql.close_cursor(DSQL_ff_c);
594: exit;
595: end if;
596: end loop; -- loop over all rows
597:
594: exit;
595: end if;
596: end loop; -- loop over all rows
597:
598: if dbms_sql.is_open(DSQL_ff_c) then
599: dbms_sql.close_cursor(DSQL_ff_c);
600: end if;
601: IF l_inv_debug_level IN(101, 102) THEN
602: INVPUTLI.info('INVPAGI2:out of loop ');
595: end if;
596: end loop; -- loop over all rows
597:
598: if dbms_sql.is_open(DSQL_ff_c) then
599: dbms_sql.close_cursor(DSQL_ff_c);
600: end if;
601: IF l_inv_debug_level IN(101, 102) THEN
602: INVPUTLI.info('INVPAGI2:out of loop ');
603: END IF;
603: END IF;
604:
605: EXCEPTION
606: when others then
607: if dbms_sql.is_open(DSQL_ff_c) then
608: dbms_sql.close_cursor(DSQL_ff_c);
609: end if;
610: err_text:= 'assign_item_header DSQL 1 '|| SQLERRM;
611: dumm_status := INVPUOPI.mtl_log_interface_err(
604:
605: EXCEPTION
606: when others then
607: if dbms_sql.is_open(DSQL_ff_c) then
608: dbms_sql.close_cursor(DSQL_ff_c);
609: end if;
610: err_text:= 'assign_item_header DSQL 1 '|| SQLERRM;
611: dumm_status := INVPUOPI.mtl_log_interface_err(
612: l_org_id,
923: BEGIN
924: IF l_inv_debug_level IN(101, 102) THEN
925: INVPUTLI.info('INVPAGI2: About to process DSQL 2 ');
926: END IF;
927: DSQL_c := dbms_sql.open_cursor;
928: dbms_sql.parse(DSQL_c, DSQL_statement, dbms_sql.native);
929: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
930: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
931: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
924: IF l_inv_debug_level IN(101, 102) THEN
925: INVPUTLI.info('INVPAGI2: About to process DSQL 2 ');
926: END IF;
927: DSQL_c := dbms_sql.open_cursor;
928: dbms_sql.parse(DSQL_c, DSQL_statement, dbms_sql.native);
929: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
930: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
931: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
932: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
925: INVPUTLI.info('INVPAGI2: About to process DSQL 2 ');
926: END IF;
927: DSQL_c := dbms_sql.open_cursor;
928: dbms_sql.parse(DSQL_c, DSQL_statement, dbms_sql.native);
929: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
930: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
931: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
932: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
933:
926: END IF;
927: DSQL_c := dbms_sql.open_cursor;
928: dbms_sql.parse(DSQL_c, DSQL_statement, dbms_sql.native);
929: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
930: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
931: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
932: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
933:
934: --There is no loop over all rows; there is actually only ONE row here..
927: DSQL_c := dbms_sql.open_cursor;
928: dbms_sql.parse(DSQL_c, DSQL_statement, dbms_sql.native);
929: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
930: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
931: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
932: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
933:
934: --There is no loop over all rows; there is actually only ONE row here..
935: if dbms_sql.fetch_rows(DSQL_c) > 0 then
928: dbms_sql.parse(DSQL_c, DSQL_statement, dbms_sql.native);
929: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
930: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
931: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
932: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
933:
934: --There is no loop over all rows; there is actually only ONE row here..
935: if dbms_sql.fetch_rows(DSQL_c) > 0 then
936: dbms_sql.column_value(DSQL_c,1,DSQL_inventory_item_id);
931: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
932: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
933:
934: --There is no loop over all rows; there is actually only ONE row here..
935: if dbms_sql.fetch_rows(DSQL_c) > 0 then
936: dbms_sql.column_value(DSQL_c,1,DSQL_inventory_item_id);
937: exists_id := DSQL_inventory_item_id;
938:
939: update MTL_SYSTEM_ITEMS_INTERFACE
932: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
933:
934: --There is no loop over all rows; there is actually only ONE row here..
935: if dbms_sql.fetch_rows(DSQL_c) > 0 then
936: dbms_sql.column_value(DSQL_c,1,DSQL_inventory_item_id);
937: exists_id := DSQL_inventory_item_id;
938:
939: update MTL_SYSTEM_ITEMS_INTERFACE
940: set inventory_item_id = exists_id
956: AND msii.transaction_id = :transaction_id_bind
957: AND rownum = 1
958: AND ' ||ff_statement_temp ;
959:
960: if dbms_sql.is_open(DSQL_c) then
961: dbms_sql.close_cursor(DSQL_c);
962: end if;
963:
964: DSQL_c := dbms_sql.open_cursor;
957: AND rownum = 1
958: AND ' ||ff_statement_temp ;
959:
960: if dbms_sql.is_open(DSQL_c) then
961: dbms_sql.close_cursor(DSQL_c);
962: end if;
963:
964: DSQL_c := dbms_sql.open_cursor;
965: dbms_sql.parse(DSQL_c, DSQL_Statement_Msii, dbms_sql.native);
960: if dbms_sql.is_open(DSQL_c) then
961: dbms_sql.close_cursor(DSQL_c);
962: end if;
963:
964: DSQL_c := dbms_sql.open_cursor;
965: dbms_sql.parse(DSQL_c, DSQL_Statement_Msii, dbms_sql.native);
966: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
967: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
968: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
961: dbms_sql.close_cursor(DSQL_c);
962: end if;
963:
964: DSQL_c := dbms_sql.open_cursor;
965: dbms_sql.parse(DSQL_c, DSQL_Statement_Msii, dbms_sql.native);
966: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
967: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
968: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
969: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
962: end if;
963:
964: DSQL_c := dbms_sql.open_cursor;
965: dbms_sql.parse(DSQL_c, DSQL_Statement_Msii, dbms_sql.native);
966: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
967: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
968: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
969: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
970:
963:
964: DSQL_c := dbms_sql.open_cursor;
965: dbms_sql.parse(DSQL_c, DSQL_Statement_Msii, dbms_sql.native);
966: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
967: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
968: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
969: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
970:
971: --There is no loop over all rows; there is actually only ONE row here..
964: DSQL_c := dbms_sql.open_cursor;
965: dbms_sql.parse(DSQL_c, DSQL_Statement_Msii, dbms_sql.native);
966: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
967: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
968: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
969: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
970:
971: --There is no loop over all rows; there is actually only ONE row here..
972: if dbms_sql.fetch_rows(DSQL_c) > 0 then
965: dbms_sql.parse(DSQL_c, DSQL_Statement_Msii, dbms_sql.native);
966: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
967: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
968: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
969: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
970:
971: --There is no loop over all rows; there is actually only ONE row here..
972: if dbms_sql.fetch_rows(DSQL_c) > 0 then
973: dbms_sql.column_value(DSQL_c,1,DSQL_inventory_item_id);
968: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
969: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
970:
971: --There is no loop over all rows; there is actually only ONE row here..
972: if dbms_sql.fetch_rows(DSQL_c) > 0 then
973: dbms_sql.column_value(DSQL_c,1,DSQL_inventory_item_id);
974: exists_id := DSQL_inventory_item_id;
975: end if;
976:
969: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
970:
971: --There is no loop over all rows; there is actually only ONE row here..
972: if dbms_sql.fetch_rows(DSQL_c) > 0 then
973: dbms_sql.column_value(DSQL_c,1,DSQL_inventory_item_id);
974: exists_id := DSQL_inventory_item_id;
975: end if;
976:
977: if exists_id IS NOT NULL then
993: set inventory_item_id = MTL_SYSTEM_ITEMS_S.nextval
994: where rowid = cr.rowid
995: returning inventory_item_id INTO cr.inventory_item_id;
996:
997: dbms_sql.close_cursor(DSQL_c);
998: end if; -- Row not in MSI and MSII
999:
1000: if dbms_sql.is_open(DSQL_c) then
1001: dbms_sql.close_cursor(DSQL_c);
996:
997: dbms_sql.close_cursor(DSQL_c);
998: end if; -- Row not in MSI and MSII
999:
1000: if dbms_sql.is_open(DSQL_c) then
1001: dbms_sql.close_cursor(DSQL_c);
1002: end if;
1003: end if; --Row not in MSI
1004: EXCEPTION
997: dbms_sql.close_cursor(DSQL_c);
998: end if; -- Row not in MSI and MSII
999:
1000: if dbms_sql.is_open(DSQL_c) then
1001: dbms_sql.close_cursor(DSQL_c);
1002: end if;
1003: end if; --Row not in MSI
1004: EXCEPTION
1005: when others then
1002: end if;
1003: end if; --Row not in MSI
1004: EXCEPTION
1005: when others then
1006: if dbms_sql.is_open(DSQL_c) then
1007: dbms_sql.close_cursor(DSQL_c);
1008: end if;
1009: err_text:= 'assign_item_header DSQL 2 '|| SQLERRM;
1010: dumm_status := INVPUOPI.mtl_log_interface_err(
1003: end if; --Row not in MSI
1004: EXCEPTION
1005: when others then
1006: if dbms_sql.is_open(DSQL_c) then
1007: dbms_sql.close_cursor(DSQL_c);
1008: end if;
1009: err_text:= 'assign_item_header DSQL 2 '|| SQLERRM;
1010: dumm_status := INVPUOPI.mtl_log_interface_err(
1011: l_org_id,