553: BEGIN /* PL-SQL Block for doing the dynamic SQL part*/
554:
555: ff_statement_temp := NULL;
556: ff_err_temp := NULL;
557: DSQL_ff_c := dbms_sql.open_cursor;
558: dummy_ret_code := INVPUTLI.get_dynamic_sql_str(1, ff_statement_temp, ff_err_temp);
559:
560: /* Now append the sql statement to the generated dynamic sql where clause
561: ** NP 02MAY96 Added xset_id and a i
571: and exists (select null
572: from mtl_system_items_b msi
573: where msii.organization_id = msi.organization_id and ' || ff_statement_temp || ')';
574:
575: dbms_sql.parse(DSQL_ff_c, DSQL_ff_statement, dbms_sql.native);
576: dbms_sql.define_column(DSQL_ff_c,1,DSQL_ff_transaction_id);
577: dbms_sql.bind_variable(DSQL_ff_c, 'set_id_bind', xset_id);
578:
579: DSQL_ff_rows_processed := dbms_sql.execute(DSQL_ff_c);
572: from mtl_system_items_b msi
573: where msii.organization_id = msi.organization_id and ' || ff_statement_temp || ')';
574:
575: dbms_sql.parse(DSQL_ff_c, DSQL_ff_statement, dbms_sql.native);
576: dbms_sql.define_column(DSQL_ff_c,1,DSQL_ff_transaction_id);
577: dbms_sql.bind_variable(DSQL_ff_c, 'set_id_bind', xset_id);
578:
579: DSQL_ff_rows_processed := dbms_sql.execute(DSQL_ff_c);
580:
573: where msii.organization_id = msi.organization_id and ' || ff_statement_temp || ')';
574:
575: dbms_sql.parse(DSQL_ff_c, DSQL_ff_statement, dbms_sql.native);
576: dbms_sql.define_column(DSQL_ff_c,1,DSQL_ff_transaction_id);
577: dbms_sql.bind_variable(DSQL_ff_c, 'set_id_bind', xset_id);
578:
579: DSQL_ff_rows_processed := dbms_sql.execute(DSQL_ff_c);
580:
581: IF l_inv_debug_level IN(101, 102) THEN
575: dbms_sql.parse(DSQL_ff_c, DSQL_ff_statement, dbms_sql.native);
576: dbms_sql.define_column(DSQL_ff_c,1,DSQL_ff_transaction_id);
577: dbms_sql.bind_variable(DSQL_ff_c, 'set_id_bind', xset_id);
578:
579: DSQL_ff_rows_processed := dbms_sql.execute(DSQL_ff_c);
580:
581: IF l_inv_debug_level IN(101, 102) THEN
582: INVPUTLI.info('INVPAGI2: About to enter DSQL loop');
583: END IF;
582: INVPUTLI.info('INVPAGI2: About to enter DSQL loop');
583: END IF;
584:
585: loop
586: if dbms_sql.fetch_rows(DSQL_ff_c) > 0 then
587: dbms_sql.column_value(DSQL_ff_c,1,DSQL_ff_transaction_id);
588: dumm_status := INVPUOPI.mtl_log_interface_err(
589: -1,
590: user_id,
583: END IF;
584:
585: loop
586: if dbms_sql.fetch_rows(DSQL_ff_c) > 0 then
587: dbms_sql.column_value(DSQL_ff_c,1,DSQL_ff_transaction_id);
588: dumm_status := INVPUOPI.mtl_log_interface_err(
589: -1,
590: user_id,
591: login_id,
607: where transaction_id = DSQL_ff_transaction_id
608: and set_process_id = nvl(xset_id, set_process_id);
609: else
610: -- no more rows, Close cursor and exit
611: dbms_sql.close_cursor(DSQL_ff_c);
612: exit;
613: end if;
614: end loop; -- loop over all rows
615:
612: exit;
613: end if;
614: end loop; -- loop over all rows
615:
616: if dbms_sql.is_open(DSQL_ff_c) then
617: dbms_sql.close_cursor(DSQL_ff_c);
618: end if;
619: IF l_inv_debug_level IN(101, 102) THEN
620: INVPUTLI.info('INVPAGI2:out of loop ');
613: end if;
614: end loop; -- loop over all rows
615:
616: if dbms_sql.is_open(DSQL_ff_c) then
617: dbms_sql.close_cursor(DSQL_ff_c);
618: end if;
619: IF l_inv_debug_level IN(101, 102) THEN
620: INVPUTLI.info('INVPAGI2:out of loop ');
621: END IF;
621: END IF;
622:
623: EXCEPTION
624: when others then
625: if dbms_sql.is_open(DSQL_ff_c) then
626: dbms_sql.close_cursor(DSQL_ff_c);
627: end if;
628: err_text:= 'assign_item_header DSQL 1 '|| SQLERRM;
629: dumm_status := INVPUOPI.mtl_log_interface_err(
622:
623: EXCEPTION
624: when others then
625: if dbms_sql.is_open(DSQL_ff_c) then
626: dbms_sql.close_cursor(DSQL_ff_c);
627: end if;
628: err_text:= 'assign_item_header DSQL 1 '|| SQLERRM;
629: dumm_status := INVPUOPI.mtl_log_interface_err(
630: l_org_id,
972: BEGIN
973: IF l_inv_debug_level IN(101, 102) THEN
974: INVPUTLI.info('INVPAGI2: About to process DSQL 2 ');
975: END IF;
976: DSQL_c := dbms_sql.open_cursor;
977: dbms_sql.parse(DSQL_c, DSQL_statement, dbms_sql.native);
978: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
979: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
980: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
973: IF l_inv_debug_level IN(101, 102) THEN
974: INVPUTLI.info('INVPAGI2: About to process DSQL 2 ');
975: END IF;
976: DSQL_c := dbms_sql.open_cursor;
977: dbms_sql.parse(DSQL_c, DSQL_statement, dbms_sql.native);
978: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
979: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
980: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
981: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
974: INVPUTLI.info('INVPAGI2: About to process DSQL 2 ');
975: END IF;
976: DSQL_c := dbms_sql.open_cursor;
977: dbms_sql.parse(DSQL_c, DSQL_statement, dbms_sql.native);
978: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
979: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
980: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
981: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
982:
975: END IF;
976: DSQL_c := dbms_sql.open_cursor;
977: dbms_sql.parse(DSQL_c, DSQL_statement, dbms_sql.native);
978: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
979: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
980: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
981: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
982:
983: --There is no loop over all rows; there is actually only ONE row here..
976: DSQL_c := dbms_sql.open_cursor;
977: dbms_sql.parse(DSQL_c, DSQL_statement, dbms_sql.native);
978: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
979: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
980: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
981: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
982:
983: --There is no loop over all rows; there is actually only ONE row here..
984: if dbms_sql.fetch_rows(DSQL_c) > 0 then
977: dbms_sql.parse(DSQL_c, DSQL_statement, dbms_sql.native);
978: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
979: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
980: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
981: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
982:
983: --There is no loop over all rows; there is actually only ONE row here..
984: if dbms_sql.fetch_rows(DSQL_c) > 0 then
985: dbms_sql.column_value(DSQL_c,1,DSQL_inventory_item_id);
980: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
981: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
982:
983: --There is no loop over all rows; there is actually only ONE row here..
984: if dbms_sql.fetch_rows(DSQL_c) > 0 then
985: dbms_sql.column_value(DSQL_c,1,DSQL_inventory_item_id);
986: exists_id := DSQL_inventory_item_id;
987:
988: update MTL_SYSTEM_ITEMS_INTERFACE
981: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
982:
983: --There is no loop over all rows; there is actually only ONE row here..
984: if dbms_sql.fetch_rows(DSQL_c) > 0 then
985: dbms_sql.column_value(DSQL_c,1,DSQL_inventory_item_id);
986: exists_id := DSQL_inventory_item_id;
987:
988: update MTL_SYSTEM_ITEMS_INTERFACE
989: set inventory_item_id = exists_id
994: -- bug10285405
995: exists_id:=NULL;
996:
997: /* fix for bug 8510589 */
998: if dbms_sql.is_open(DSQL_c) then
999: dbms_sql.close_cursor(DSQL_c);
1000: end if;
1001:
1002: else
995: exists_id:=NULL;
996:
997: /* fix for bug 8510589 */
998: if dbms_sql.is_open(DSQL_c) then
999: dbms_sql.close_cursor(DSQL_c);
1000: end if;
1001:
1002: else
1003: --Adding resolution of Item Id from Master in same batch (from Intf table)
1015: AND msii.transaction_id = :transaction_id_bind
1016: AND rownum = 1
1017: AND ' ||ff_statement_temp ;
1018:
1019: if dbms_sql.is_open(DSQL_c) then
1020: dbms_sql.close_cursor(DSQL_c);
1021: end if;
1022:
1023: DSQL_c := dbms_sql.open_cursor;
1016: AND rownum = 1
1017: AND ' ||ff_statement_temp ;
1018:
1019: if dbms_sql.is_open(DSQL_c) then
1020: dbms_sql.close_cursor(DSQL_c);
1021: end if;
1022:
1023: DSQL_c := dbms_sql.open_cursor;
1024: dbms_sql.parse(DSQL_c, DSQL_Statement_Msii, dbms_sql.native);
1019: if dbms_sql.is_open(DSQL_c) then
1020: dbms_sql.close_cursor(DSQL_c);
1021: end if;
1022:
1023: DSQL_c := dbms_sql.open_cursor;
1024: dbms_sql.parse(DSQL_c, DSQL_Statement_Msii, dbms_sql.native);
1025: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
1026: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
1027: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
1020: dbms_sql.close_cursor(DSQL_c);
1021: end if;
1022:
1023: DSQL_c := dbms_sql.open_cursor;
1024: dbms_sql.parse(DSQL_c, DSQL_Statement_Msii, dbms_sql.native);
1025: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
1026: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
1027: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
1028: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
1021: end if;
1022:
1023: DSQL_c := dbms_sql.open_cursor;
1024: dbms_sql.parse(DSQL_c, DSQL_Statement_Msii, dbms_sql.native);
1025: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
1026: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
1027: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
1028: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
1029:
1022:
1023: DSQL_c := dbms_sql.open_cursor;
1024: dbms_sql.parse(DSQL_c, DSQL_Statement_Msii, dbms_sql.native);
1025: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
1026: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
1027: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
1028: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
1029:
1030: --There is no loop over all rows; there is actually only ONE row here..
1023: DSQL_c := dbms_sql.open_cursor;
1024: dbms_sql.parse(DSQL_c, DSQL_Statement_Msii, dbms_sql.native);
1025: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
1026: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
1027: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
1028: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
1029:
1030: --There is no loop over all rows; there is actually only ONE row here..
1031: if dbms_sql.fetch_rows(DSQL_c) > 0 then
1024: dbms_sql.parse(DSQL_c, DSQL_Statement_Msii, dbms_sql.native);
1025: dbms_sql.define_column(DSQL_c,1,DSQL_inventory_item_id);
1026: dbms_sql.bind_variable(DSQL_c, 'set_id_bind2', xset_id);
1027: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
1028: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
1029:
1030: --There is no loop over all rows; there is actually only ONE row here..
1031: if dbms_sql.fetch_rows(DSQL_c) > 0 then
1032: dbms_sql.column_value(DSQL_c,1,DSQL_inventory_item_id);
1027: dbms_sql.bind_variable(DSQL_c, 'transaction_id_bind', cr.transaction_id);
1028: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
1029:
1030: --There is no loop over all rows; there is actually only ONE row here..
1031: if dbms_sql.fetch_rows(DSQL_c) > 0 then
1032: dbms_sql.column_value(DSQL_c,1,DSQL_inventory_item_id);
1033: exists_id := DSQL_inventory_item_id;
1034: end if;
1035:
1028: DSQL_rows_processed := dbms_sql.execute(DSQL_c);
1029:
1030: --There is no loop over all rows; there is actually only ONE row here..
1031: if dbms_sql.fetch_rows(DSQL_c) > 0 then
1032: dbms_sql.column_value(DSQL_c,1,DSQL_inventory_item_id);
1033: exists_id := DSQL_inventory_item_id;
1034: end if;
1035:
1036: if exists_id IS NOT NULL then
1061: where rowid = cr.rowid;
1062:
1063: select MTL_SYSTEM_ITEMS_S.CURRVAL INTO cr.inventory_item_id FROM DUAL;
1064:
1065: dbms_sql.close_cursor(DSQL_c);
1066: end if; -- Row not in MSI and MSII
1067:
1068: if dbms_sql.is_open(DSQL_c) then
1069: dbms_sql.close_cursor(DSQL_c);
1064:
1065: dbms_sql.close_cursor(DSQL_c);
1066: end if; -- Row not in MSI and MSII
1067:
1068: if dbms_sql.is_open(DSQL_c) then
1069: dbms_sql.close_cursor(DSQL_c);
1070: end if;
1071: end if; --Row not in MSI
1072: EXCEPTION
1065: dbms_sql.close_cursor(DSQL_c);
1066: end if; -- Row not in MSI and MSII
1067:
1068: if dbms_sql.is_open(DSQL_c) then
1069: dbms_sql.close_cursor(DSQL_c);
1070: end if;
1071: end if; --Row not in MSI
1072: EXCEPTION
1073: when others then
1070: end if;
1071: end if; --Row not in MSI
1072: EXCEPTION
1073: when others then
1074: if dbms_sql.is_open(DSQL_c) then
1075: dbms_sql.close_cursor(DSQL_c);
1076: end if;
1077: err_text:= 'assign_item_header DSQL 2 '|| SQLERRM;
1078: dumm_status := INVPUOPI.mtl_log_interface_err(
1071: end if; --Row not in MSI
1072: EXCEPTION
1073: when others then
1074: if dbms_sql.is_open(DSQL_c) then
1075: dbms_sql.close_cursor(DSQL_c);
1076: end if;
1077: err_text:= 'assign_item_header DSQL 2 '|| SQLERRM;
1078: dumm_status := INVPUOPI.mtl_log_interface_err(
1079: l_org_id,