7142: l_stmt := l_stmt || 'SELECT COUNT(*) from mtl_item_locations where organization_id = '||P_ORG_ID||' and nvl(subinventory_code,''@@@'') <> '''|| P_SUBINV ||''' and '|| L_WHERE_CLAUSE ;
7143:
7144: --dbms_output.put_line('l_stmt: '||l_stmt);
7145:
7146: c := dbms_sql.open_cursor;
7147:
7148: DBMS_SQL.PARSE(C, L_STMT, DBMS_SQL.NATIVE);
7149: dbms_sql.define_column(c,1,loc_count);
7150:
7144: --dbms_output.put_line('l_stmt: '||l_stmt);
7145:
7146: c := dbms_sql.open_cursor;
7147:
7148: DBMS_SQL.PARSE(C, L_STMT, DBMS_SQL.NATIVE);
7149: dbms_sql.define_column(c,1,loc_count);
7150:
7151: rows_processed := dbms_sql.execute(c);
7152:
7145:
7146: c := dbms_sql.open_cursor;
7147:
7148: DBMS_SQL.PARSE(C, L_STMT, DBMS_SQL.NATIVE);
7149: dbms_sql.define_column(c,1,loc_count);
7150:
7151: rows_processed := dbms_sql.execute(c);
7152:
7153: --dbms_output.put_line('rows_processed:'||rows_processed);
7147:
7148: DBMS_SQL.PARSE(C, L_STMT, DBMS_SQL.NATIVE);
7149: dbms_sql.define_column(c,1,loc_count);
7150:
7151: rows_processed := dbms_sql.execute(c);
7152:
7153: --dbms_output.put_line('rows_processed:'||rows_processed);
7154:
7155: IF DBMS_SQL.FETCH_ROWS(C)> 0 THEN
7151: rows_processed := dbms_sql.execute(c);
7152:
7153: --dbms_output.put_line('rows_processed:'||rows_processed);
7154:
7155: IF DBMS_SQL.FETCH_ROWS(C)> 0 THEN
7156: DBMS_SQL.COLUMN_VALUE(C,1,LOC_COUNT);
7157: dbms_output.put_line('LOC_COUNT:'||LOC_COUNT);
7158: end if;
7159:
7152:
7153: --dbms_output.put_line('rows_processed:'||rows_processed);
7154:
7155: IF DBMS_SQL.FETCH_ROWS(C)> 0 THEN
7156: DBMS_SQL.COLUMN_VALUE(C,1,LOC_COUNT);
7157: dbms_output.put_line('LOC_COUNT:'||LOC_COUNT);
7158: end if;
7159:
7160: DBMS_SQL.CLOSE_CURSOR(C);
7156: DBMS_SQL.COLUMN_VALUE(C,1,LOC_COUNT);
7157: dbms_output.put_line('LOC_COUNT:'||LOC_COUNT);
7158: end if;
7159:
7160: DBMS_SQL.CLOSE_CURSOR(C);
7161:
7162: IF LOC_COUNT > 0 THEN
7163: P_LOC_EXISTS := 'Y';
7164: else