BULK In-BIND and FORALL

Hi All,
Could someone help me in solving the error 'DML statement without BULK In-BIND cannot be used inside FORALL'. I am getting the error when running the following query.
DECLARE
v_seq_row_id NUMBER;
TYPE ap_addr_tt IS TABLE OF IN_EIM_ADDR_PER.AP_ADDR%TYPE;
TYPE ap_addr_name_tt IS TABLE OF IN_EIM_ADDR_PER.AP_ADDR_NAME%TYPE;
TYPE ap_disc_flg_tt IS TABLE OF IN_EIM_ADDR_PER.AP_DISACLEANSE_FLG%TYPE;
TYPE ap_name_lock_flg_tt IS TABLE OF IN_EIM_ADDR_PER.AP_NAME_LOCK_FLG%TYPE;
TYPE ap_pre_flg_tt IS TABLE OF IN_EIM_ADDR_PER.AP_PREMISE_FLG%TYPE;
coll_v_AP_ADDR ap_addr_tt;
coll_v_AP_ADDR_NAME ap_addr_tt;
coll_v_AP_DISACLEANSE_FLG ap_disc_flg_tt;
coll_v_AP_NAME_LOCK_FLG ap_name_lock_flg_tt;
coll_v_AP_PREMISE_FLG ap_pre_flg_tt;
BEGIN
SELECT
DISTINCT(AP_ADDR),
AP_ADDR_NAME,
AP_DISACLEANSE_FLG,
AP_NAME_LOCK_FLG,
AP_PREMISE_FLG
BULK COLLECT INTO
coll_v_AP_ADDR,
coll_v_AP_ADDR_NAME,
coll_v_AP_DISACLEANSE_FLG,
coll_v_AP_NAME_LOCK_FLG,
coll_v_AP_PREMISE_FLG
FROM
IN_EIM_ADDR_PER;
FORALL indx IN coll_v_AP_ADDR.FIRST.. coll_v_AP_ADDR.LAST
SELECT seq_dm_row_id.NEXTVAL INTO v_seq_row_id FROM DUAL;
/* for test only - more columns from will be included*/
INSERT INTO SIEBEL.EIM_ADDR_PER
(ROW_ID) VALUES (v_seq_row_id );
END;
I am new to collections and used cursors most of the time. It would be great if someone help me in solving this issue, which I am trying for looong time.
Thanks.
Yar

Hi,
I like to get clarified, Instead of the declaring individual variables can I try some like below. Could anyone advice me on this.
TYPE in_tbl_col_type_rec IS RECORD (
ap_addr_tt IN_EIM_ADDR_PER.AP_ADDR%TYPE,
ap_addr_name_tt IN_EIM_ADDR_PER.AP_ADDR_NAME%TYPE,
ap_disc_flg_tt IN_EIM_ADDR_PER.AP_DISACLEANSE_FLG%TYPE,
ap_name_lock_flg_tt IN_EIM_ADDR_PER.AP_NAME_LOCK_FLG%TYPE,
ap_pre_flg_tt IN_EIM_ADDR_PER.AP_PREMISE_FLG%TYPE);
TYPE in_tbl_col_type_tbl IS TABLE OF in_tbl_col_type_rec
INDEX BY PLS_INTEGER;
v_in_tbl_col in_tbl_col_type_rec;
And I am trying to use,
FORALL indx IN v_in_tbl_col.FIRST.. v_in_tbl_col.LAST
which is giving the error 'component 'FIRST' must be declared'.
Thanks,
Yar

Similar Messages

  • BULK COLLECT and FORALL with dynamic INSERT.

    Hello,
    I want to apply BULK COLLECT and FORALL feature for a insert statement in my procedure for performance improvements as it has to insert a huge amount of data.
    But the problem is that the insert statement gets generated dynamically and even the table name is found at the run-time ... so i am not able to apply the performance tuning concepts.
    See below the code
    PROCEDURE STP_MES_INSERT_GLOBAL_TO_MAIN
      (P_IN_SRC_TABLE_NAME                  VARCHAR2 ,
      P_IN_TRG_TABLE_NAME                  VARCHAR2 ,
      P_IN_ED_TRIG_ALARM_ID                 NUMBER ,
      P_IN_ED_CATG_ID                 NUMBER ,
      P_IN_IS_PIECEID_ALARM IN CHAR,
      P_IN_IS_LAST_RECORD IN CHAR
    IS
          V_START_DATA_ID                 NUMBER;
          V_STOP_DATA_ID                   NUMBER;
          V_FROM_DATA_ID                   NUMBER;
          V_TO_DATA_ID                       NUMBER;
          V_MAX_REC_IN_LOOP              NUMBER := 30000;
          V_QRY1         VARCHAR2(32767);
    BEGIN
                EXECUTE IMMEDIATE 'SELECT MIN(ED_DATA_ID), MAX(ED_DATA_ID) FROM '|| P_IN_SRC_TABLE_NAME INTO V_START_DATA_ID , V_STOP_DATA_ID;
                --DBMS_OUTPUT.PUT_LINE('ORIGINAL START ID := '||V_START_DATA_ID ||' ORIGINAL  STOP ID := ' || V_STOP_DATA_ID);
                V_FROM_DATA_ID := V_START_DATA_ID ;
                IF (V_STOP_DATA_ID - V_START_DATA_ID ) > V_MAX_REC_IN_LOOP THEN
                        V_TO_DATA_ID := V_START_DATA_ID + V_MAX_REC_IN_LOOP;
                ELSE
                       V_TO_DATA_ID := V_STOP_DATA_ID;
                END IF;
              LOOP
                    BEGIN
                 LOOP      
                            V_QRY1 := ' INSERT INTO '||P_IN_TRG_TABLE_NAME||
                            ' SELECT * FROM '||P_IN_SRC_TABLE_NAME ||
                            ' WHERE ED_DATA_ID BETWEEN ' || V_FROM_DATA_ID ||' AND ' || V_TO_DATA_ID;
                    EXECUTE IMMEDIATE V_QRY1;
    commit;
                                     V_FROM_DATA_ID :=  V_TO_DATA_ID + 1;
                            IF  ( V_STOP_DATA_ID - V_TO_DATA_ID > V_MAX_REC_IN_LOOP ) THEN
                                  V_TO_DATA_ID := V_TO_DATA_ID + V_MAX_REC_IN_LOOP;
                            ELSE
                                  V_TO_DATA_ID := V_TO_DATA_ID + (V_STOP_DATA_ID - V_TO_DATA_ID);
                            END IF;
                    EXCEPTION
                             WHEN OTHERS THEN.............
    ....................so on Now you can observer here that P_IN_SRC_TABLE_NAME is the source table name which we get as a parameter at run-time. I have used 2 table in the insert statement P_IN_TRG_TABLE_NAME (in which i have to insert data) and P_IN_SRC_TABLE_NAME(from where i have to insert data)
      V_QRY1 := ' INSERT INTO '||P_IN_TRG_TABLE_NAME||
                            ' SELECT * FROM '||P_IN_SRC_TABLE_NAME ||
                            ' WHERE ED_DATA_ID BETWEEN ' || V_FROM_DATA_ID ||' AND ' || V_TO_DATA_ID;
                    EXECUTE IMMEDIATE V_QRY1;now when i appy the bulk collect and forall feature i am facing the out of scope problem....see the code below ...
    BEGIN
                EXECUTE IMMEDIATE 'SELECT MIN(ED_DATA_ID), MAX(ED_DATA_ID) FROM '|| P_IN_SRC_TABLE_NAME INTO V_START_DATA_ID , V_STOP_DATA_ID;
                --DBMS_OUTPUT.PUT_LINE('ORIGINAL START ID := '||V_START_DATA_ID ||' ORIGINAL  STOP ID := ' || V_STOP_DATA_ID);
                V_FROM_DATA_ID := V_START_DATA_ID ;
                IF (V_STOP_DATA_ID - V_START_DATA_ID ) > V_MAX_REC_IN_LOOP THEN
                        V_TO_DATA_ID := V_START_DATA_ID + V_MAX_REC_IN_LOOP;
                ELSE
                       V_TO_DATA_ID := V_STOP_DATA_ID;
                END IF;
              LOOP
                    DECLARE
                     TYPE TRG_TABLE_TYPE IS TABLE OF P_IN_SRC_TABLE_NAME%ROWTYPE;
                     V_TRG_TABLE_TYPE TRG_TABLE_TYPE;
                     CURSOR TRG_TAB_CUR IS
                     SELECT * FROM P_IN_SRC_TABLE_NAME
                     WHERE ED_DATA_ID BETWEEN V_FROM_DATA_ID AND V_TO_DATA_ID;
                     V_QRY1 varchar2(32767);
                    BEGIN
                    OPEN TRG_TAB_CUR;
                    LOOP
                    FETCH TRG_TAB_CUR BULK COLLECT INTO V_TRG_TABLE_TYPE LIMIT 30000;
                    FORALL I IN 1..V_TRG_TABLE_TYPE.COUNT
                    V_QRY1 := ' INSERT INTO '||P_IN_TRG_TABLE_NAME||' VALUES V_TRG_TABLE_TYPE(I);'
                    EXECUTE IMMEDIATE V_QRY1;
                    EXIT WHEN TRG_TAB_CUR%NOTFOUND;
                    END LOOP;
                    CLOSE TRG_TAB_CUR;
                            V_FROM_DATA_ID :=  V_TO_DATA_ID + 1;
                            IF  ( V_STOP_DATA_ID - V_TO_DATA_ID > V_MAX_REC_IN_LOOP ) THEN
                                  V_TO_DATA_ID := V_TO_DATA_ID + V_MAX_REC_IN_LOOP;
                            ELSE
                                  V_TO_DATA_ID := V_TO_DATA_ID + (V_STOP_DATA_ID - V_TO_DATA_ID);
                            END IF;
                    EXCEPTION
                             WHEN OTHERS THEN.........so on
    But the above code is not helping me ,  what i am doing wrong ??? how can i tune this dynamically generated statement to use bulk collect for better performace ......
    Thanks in Advance !!!!

    Hello,
    a table name cannot be bind as a parameter in SQL, this wont't compile:
    EXECUTE IMMEDIATE ' INSERT INTO :1 VALUES ......
    USING P_IN_TRG_TABLE_NAME ...but this should work:
    EXECUTE IMMEDIATE ' INSERT INTO ' || P_IN_TRG_TABLE_NAME || ' VALUES ......You cannot declare a type that is based on a table which name is in a variable.
    PL/SQL is stronly typed language, a type must be known at compile time, a code like this is not allowed:
    PROCEDURE xx( src_table_name varchar2 )
    DECLARE
       TYPE tab IS TABLE OF src_table_name%ROWTYPE;
      ...This can be done by creating one big dynamic SQL - see example below (tested on Oracle 10 XE - this is a slightly simplified version of your procedure):
    CREATE OR REPLACE
    PROCEDURE stp1(
      p_in_src_table_name                  VARCHAR2 ,
      p_in_trg_table_name                  VARCHAR2 ,
      v_from_data_id     NUMBER := 100,
      v_to_data_id       NUMBER := 100000
    IS
    BEGIN
      EXECUTE IMMEDIATE q'{
      DECLARE
         TYPE trg_table_type IS TABLE OF }' || p_in_src_table_name || q'{%ROWTYPE;
         V_TRG_TABLE_TYPE TRG_TABLE_TYPE;
         CURSOR TRG_TAB_CUR IS
         SELECT * FROM }' || p_in_src_table_name ||
         q'{ WHERE ED_DATA_ID BETWEEN :V_FROM_DATA_ID AND :V_TO_DATA_ID;
      BEGIN
          OPEN TRG_TAB_CUR;
          LOOP
                FETCH TRG_TAB_CUR BULK COLLECT INTO V_TRG_TABLE_TYPE LIMIT 30000;
                FORALL I IN 1 .. V_TRG_TABLE_TYPE.COUNT
                INSERT INTO }' || p_in_trg_table_name || q'{ VALUES V_TRG_TABLE_TYPE( I );
                EXIT WHEN TRG_TAB_CUR%NOTFOUND;
          END LOOP;
          CLOSE TRG_TAB_CUR;
      END; }'
      USING v_from_data_id, v_to_data_id;
      COMMIT;
    END;But this probably won't give any performace improvements. Bulk collect and forall can give performance improvements when there is a DML operation inside a loop,
    and this one single DML operates on only one record or relatively small number of records, and this DML is repeated many many times in the loop.
    I guess that your code is opposite to this - it contains insert statement that operates on many records (one single insert ~ 30000 records),
    and you are trying to replace it with bulk collect/forall - INSERT INTO ... SELECT FROM will almost alwayst be faster than bulk collect/forall.
    Look at simple test - below is a procedure that uses INSERT ... SELECT :
    CREATE OR REPLACE
    PROCEDURE stp(
      p_in_src_table_name                  VARCHAR2 ,
      p_in_trg_table_name                  VARCHAR2 ,
      v_from_data_id     NUMBER := 100,
      v_to_data_id       NUMBER := 100000
    IS
    V_QRY1 VARCHAR2(32767);
    BEGIN
          V_QRY1 := ' INSERT INTO '||   P_IN_TRG_TABLE_NAME ||
                    ' SELECT * FROM '|| P_IN_SRC_TABLE_NAME ||
                    ' WHERE ed_data_id BETWEEN :f AND :t ';
          EXECUTE IMMEDIATE V_QRY1
          USING V_FROM_DATA_ID, V_TO_DATA_ID;
          COMMIT;
    END;
    /and we can compare both procedures:
    SQL> CREATE TABLE test333
      2  AS SELECT level ed_data_id ,
      3            'XXX ' || LEVEL x,
      4            'YYY ' || 2 * LEVEL y
      5  FROM dual
      6  CONNECT BY LEVEL <= 1000000;
    Table created.
    SQL> CREATE TABLE test333_dst AS
      2  SELECT * FROM test333 WHERE 1 = 0;
    Table created.
    SQL> set timing on
    SQL> ed
    Wrote file afiedt.buf
      1  BEGIN
      2     FOR i IN 1 .. 100 LOOP
      3        stp1( 'test333', 'test333_dst', 1000, 31000 );
      4     END LOOP;
      5* END;
    SQL> /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:22.12
    SQL> ed
    Wrote file afiedt.buf
      1  BEGIN
      2     FOR i IN 1 .. 100 LOOP
      3        stp( 'test333', 'test333_dst', 1000, 31000 );
      4     END LOOP;
      5* END;
    SQL> /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:14.86without bulk collect ~ 15 sec.
    bulk collect version ~ 22 sec. .... 7 sec longer / 15 sec. = about 45% performance decrease.

  • How to use Bulk Collect and Forall

    Hi all,
    We are on Oracle 10g. I have a requirement to read from table A and then for each record in table A, find matching rows in table B and then write the identified information in table B to the target table (table C). In the past, I had used two ‘cursor for loops’ to achieve that. To make the new procedure, more efficient, I would like to learn to use ‘bulk collect’ and ‘forall’.
    Here is what I have so far:
    DECLARE
    TYPE employee_array IS TABLE OF EMPLOYEES%ROWTYPE;
    employee_data  employee_array;
    TYPE job_history_array IS TABLE OF JOB_HISTORY%ROWTYPE;
    Job_history_data   job_history_array;
    BatchSize CONSTANT POSITIVE := 5;
    -- Read from File A
    CURSOR c_get_employees IS
             SELECT  Employee_id,
                       first_name,
                       last_name,
                       hire_date,
                       job_id
              FROM EMPLOYEES;
    -- Read from File B based on employee ID in File A
    CURSOR c_get_job_history (p_employee_id number) IS
             select start_date,
                      end_date,
                      job_id,
                      department_id
             FROM JOB_HISTORY
             WHERE employee_id = p_employee_id;
    BEGIN
        OPEN c_get_employees;
        LOOP
            FETCH c_get_employees BULK COLLECT INTO employee_data.employee_id.LAST,
                                                                              employee_data.first_name.LAST,
                                                                              employee_data.last_name.LAST,
                                                                              employee_data.hire_date.LAST,
                                                                              employee_data.job_id.LAST
             LIMIT BatchSize;
            FORALL i in 1.. employee_data.COUNT
                    Open c_get_job_history (employee_data(i).employee_id);
                    FETCH c_get_job_history BULKCOLLECT INTO job_history_array LIMIT BatchSize;
                             FORALL k in 1.. Job_history_data.COUNT LOOP
                                            -- insert into FILE C
                                              INSERT INTO MY_TEST(employee_id, first_name, last_name, hire_date, job_id)
                                                                values (job_history_array(k).employee_id, job_history_array(k).first_name,
                                                                          job_history_array(k).last_name, job_history_array(k).hire_date,
                                                                          job_history_array(k).job_id);
                                             EXIT WHEN job_ history_data.count < BatchSize                        
                             END LOOP;                          
                             CLOSE c_get_job_history;                          
                     EXIT WHEN employee_data.COUNT < BatchSize;
           END LOOP;
            COMMIT;
            CLOSE c_get_employees;
    END;
                     When I run this script, I get
    [Error] Execution (47: 17): ORA-06550: line 47, column 17:
    PLS-00103: Encountered the symbol "OPEN" when expecting one of the following:
       . ( * @ % & - + / at mod remainder rem select update with
       <an exponent (**)> delete insert || execute multiset save
       merge
    ORA-06550: line 48, column 17:
    PLS-00103: Encountered the symbol "FETCH" when expecting one of the following:
       begin function package pragma procedure subtype type use
       <an identifier> <a double-quoted delimited-identifier> form
       current cursorWhat is the best way to code this? Once, I learn how to do this, I apply the knowledge to the real application in which file A would have around 200 rows and file B would have hundreds of thousands of rows.
    Thank you for your guidance,
    Seyed

    Hello BlueShadow,
    Following your advice, I modified a stored procedure that initially was using two cursor for loops to read from tables A and B to write to table C to use instead something like your suggestion listed below:
    INSERT INTO tableC
    SELECT …
    FROM tableA JOIN tableB on (join condition).I tried this change on a procedure writing to tableC with keys disabled. I will try this against the real table that has primary key and indexes and report the result later.
    Thank you very much,
    Seyed

  • PLS-00435: DML statement without BULK In-BIND cannot be used

    My requirement
    I am dynamically creating a staging table my_stg, and then populate it. Seems simple, but not sure why i get this error,
    create table gtest4(myid varchar2(10), mykey varchar2(10));
    create table gtest5(myid varchar2(10), mykey varchar2(10));
    insert into gtest4 values(1,3);
    insert into gtest4 values(2,7);
    insert into gtest5 values(5,3);
    insert into gtest5 values (1,7);
    commit;
    /* Formatted on 2012/01/27 17:52 (Formatter Plus v4.8.8) */
    CREATE OR REPLACE PROCEDURE px
    IS
    TYPE rectype IS RECORD (
    myid VARCHAR2 (100),
    mykey VARCHAR2 (100)
    TYPE tabtype IS TABLE OF rectype
    INDEX BY BINARY_INTEGER;
    rec tabtype;
    cur sys_refcursor;
    BEGIN
    EXECUTE IMMEDIATE 'create table my_stg(myid varchar2(100), mykey varchar2(100)) ';
    OPEN cur FOR 'select a.myid, b.mykey
    from gtest4 a, gtest5 b
    where a.mykey = b.mykey';
    LOOP
    FETCH cur
    BULK COLLECT INTO rec LIMIT 500;
    FORALL i IN 1 .. rec.COUNT
    EXECUTE IMMEDIATE 'insert into my_stg(myid, mykey) values (rec(i).myid,
    rec(i).mykey)';
    EXIT WHEN cur%NOTFOUND;
    END LOOP;
    END;
    I compile the above proc, and get
    PLS-00435: DML statement without BULK In-BIND cannot be used
    the reason I do insert in execute immediate is because the table my_stg does not exist, it is created on the fly

    I tried the below, used plsql table variables instead of record type
    CREATE OR REPLACE PROCEDURE px
    IS
    TYPE rectype IS RECORD (
    myid VARCHAR2 (100),
    mykey VARCHAR2 (100)
    TYPE tabtype1 IS TABLE OF varchar2(100)
    INDEX BY BINARY_INTEGER;
    TYPE tabtype2 IS TABLE OF varchar2(100)
    INDEX BY BINARY_INTEGER;
    rec1 tabtype1;
    rec2 tabtype2;
    cur sys_refcursor;
    BEGIN
    EXECUTE IMMEDIATE 'create table my_stg(myid varchar2(100), mykey varchar2(100)) ';
    OPEN cur FOR 'select a.myid, b.mykey
    from gtest4 a, gtest5 b
    where a.mykey = b.mykey';
    LOOP
    FETCH cur
    BULK COLLECT INTO rec1, rec2 LIMIT 500;
    FORALL i IN 1 .. rec.COUNT
    execute immediate 'insert into my_stg(myid, mykey) values (:1,:2)
    using rec1(i).myid, rec2(i).mykey;
    EXIT WHEN cur%NOTFOUND;
    END LOOP;
    END;
    I get error
    PLS-00103: Encountered the symbol "insert into my_stg(myi
    mykey) values (:1,:2)
    using rec1(i).myi" when expecting one of the following:
    ( - + case mod new not null <an identifier>
    <a double-quoted delimited-identifier> <a bind variable>
    count current exists max min prior sql stddev sum varianc
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    <an alternatively-quoted string literal
    Please help

  • Bulk in Bind exception

    Hello there,
    I wanted to ask is there a limitation for use of FORALL with PL SQL table.COUNT
    i'm getting error Bulk in Bind exception by the following codesnippet:
    FORALL i in 1 .. cst.COUNT
    INSERT ........
    COMMIT;
    END LOOP;
    Database is 10g

    Hi,
    I encountered a similar Bulk Bind problem some days back while using forall and Table collections. May be it is similar to yours.
    Well I tried to reference different fields inside the Table Collection within a single forall insert. This problem can be avoided if you break your single Table collection into multiple single column collections. Please see below for example:
    SQL> CREATE TABLE test_bulk_forall
      2  (
      3  name1 VARCHAR2(100),
      4  name2 VARCHAR2(100))
      5  ;
    Table created.Problem code:
    SQL> DECLARE
      2      TYPE v_Rec_Bulk_Forall IS RECORD ( vName1 test_bulk_forall.name1%TYPE
      3                                       , vName2 test_bulk_forall.name2%TYPE);
      4      TYPE v_Typ_Bulk_Forall Is TABLE OF v_Rec_Bulk_Forall;
      5      v_Tab_Bulk_Forall v_Typ_Bulk_Forall;
      6  BEGIN
      7      v_Tab_Bulk_Forall(1).vName1 := 'FirstName1';
      8      v_Tab_Bulk_Forall(1).vName2 := 'LastName1';
      9      v_Tab_Bulk_Forall(2).vName1 := 'FirstName2';
    10      v_Tab_Bulk_Forall(2).vName2 := 'LastName2';
    11      FORALL Loop_Tab_Bulk_Forall IN 1..v_Tab_Bulk_Forall.COUNT
    12          INSERT INTO test_bulk_forall
    13              (Name1,
    14               Name2)
    15             VALUES
    16                 (v_Tab_Bulk_Forall(Loop_Tab_Bulk_Forall).vName1
    17                 ,v_Tab_Bulk_Forall(Loop_Tab_Bulk_Forall).vName2);
    18     COMMIT;
    19  END;
    20  /
                        (v_Tab_Bulk_Forall(Loop_Tab_Bulk_Forall).vName1
    ERROR at line 16:
    ORA-06550: line 16, column 8:
    PLS-00436: implementation restriction: cannot reference fields of BULK In-BIND
    table of records
    ORA-06550: line 16, column 8:
    PLS-00382: expression is of wrong type
    ORA-06550: line 17, column 5:
    PLS-00436: implementation restriction: cannot reference fields of BULK In-BIND
    table of records
    ORA-06550: line 17, column 5:
    PLS-00382: expression is of wrong type
    ORA-06550: line 16, column 8:
    PL/SQL: ORA-22806: not an object or REF
    ORA-06550: line 12, column 9:
    PL/SQL: SQL Statement ignoredCorrected Code:
    SQL> DECLARE
      2      TYPE v_Typ_Bulk_Forall Is TABLE OF VARCHAR2(20) INDEX BY PLS_INTEGER;
      3      v_Tab_Bulk_Forall_Name1 v_Typ_Bulk_Forall;
      4      v_Tab_Bulk_Forall_Name2 v_Typ_Bulk_Forall;
      5  BEGIN
      6      v_Tab_Bulk_Forall_Name1(1) := 'FirstName1';
      7      v_Tab_Bulk_Forall_Name2(1) := 'LastName1';
      8      v_Tab_Bulk_Forall_Name1(2) := 'FirstName2';
      9      v_Tab_Bulk_Forall_Name2(2) := 'LastName2';
    10      FORALL Loop_Tab_Bulk_Forall IN 1..v_Tab_Bulk_Forall_Name1.COUNT
    11          INSERT INTO test_bulk_forall
    12              (Name1,
    13               Name2)
    14             VALUES
    15                 (v_Tab_Bulk_Forall_Name1(Loop_Tab_Bulk_Forall)
    16                 ,v_Tab_Bulk_Forall_Name2(Loop_Tab_Bulk_Forall));
    17     COMMIT;
    18  END;
    19  /
    PL/SQL procedure successfully completed.
    SQL> select * from test_bulk_forall;
    NAME1         NAME2
    FirstName1   LastName1
    FirstName2   LastName2Hope this helps.

  • Bulk collect insert using forall

    Hi all,
    in the following statement:
    declare
    cursor C is select id,PEOPLE_ID from CN_ITEMS;
    type T_A is table of cn_items%rowtype;
    V_A T_A;
    begin
    open c;
    LOOP
    fetch c bulk collect into v_a;
    forall  I in V_A.first..V_A.last 
        insert into CN_TAXES(id,CREATION_DATE,TAX_PRICE,ITEM_ID,PEOPLE_ID)
                     values (CN_TAX_S.NEXTVAL, sysdate,10.5,v_a.id(i),v_a.people_id(i));
      exit when c%notfound;
    end loop;
    end;
    /i receive error:
    ORA-06550: line 13, column 2:
    PLS-00394: wrong number of values in the INTO list of a FETCH statement
    ORA-06550: line 13, column 2:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 20, column 61:
    PLS-00302: component 'ID' must be declared
    ORA-06550: line 20, column 71:
    PLS-00302: component 'PEOPLE_ID' must be declared
    ORA-06550: line 20, column 71:
    PLS-00302: component 'PEOPLE_ID' must be declared
    ORA-06550: line 20, column 67:
    PL/SQL: ORA-00904: "V_A"."PEOPLE_ID": invalid identifier
    ORA-06550: line 19, column 5:
    PL/SQL: SQL Statement ignored
    06550. 00000 -  "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:Any ideas how to use in this situation FORALL? If i select all values from one table and then i use FORALL to insert them in another table with same columns is ok, but here i just want to use values from fetching to insert them in 2 columns of other table...
    Version : 11g
    Thanks in advance,
    Bahchevanov.

    >
    Any ideas how to use in this situation FORALL? If i select all values from one table and then i use FORALL to insert them in another table with same columns is ok
    >
    You have answered your own question. The solution is exactly what you just said above
    >
    select all values from one table and then i use FORALL to insert them in another table with same columns
    >
    The first error you were getting
    PLS-00394: wrong number of values in the INTO list of a FETCH statementis because of this code
    cursor C is select id,PEOPLE_ID from CN_ITEMS;
    type T_A is table of cn_items%rowtype;Your T_A variable is based on the CN_ITEMS table but since you are using a cursor you should base it on the cursor
    cursor C is select id,PEOPLE_ID from CN_ITEMS;
    type T_A is table of C%rowtype;You are also selecting ID but never using it. And you have an OUTER loop but did not use a LIMIT clause. A straight BULK COLLECT will collect everything at once so there is no purpose for the outer loop. But you should always use a limit clause rather than any implicit one.
    So if you must use a bulk collect solution (even though your specifics should be using pure SQL) then to fix your problem change that code to this
    cursor C is select CN_TAX_S.NEXTVAL, sysdate, 10.5,PEOPLE_ID from CN_ITEMS;
    type T_A is table of C%rowtype;In other words just construct a row that will match your target table. Then you can use the FORALL to insert the entire row at once (note the LIMIT clause)
    LOOP
    fetch c bulk collect into v_a LIMIT 1000;
    forall  I in V_A.first..V_A.last 
        insert into CN_TAXES(id,CREATION_DATE,TAX_PRICE,ITEM_ID,PEOPLE_ID)
                     values (V_A(I));
      exit when c%notfound;
    end loop;

  • Model Binding and Calculated Field Syntax for "class" Attribute

    Hi,
    I tried to use the calculated field syntax from SAP UI5 to change the CSS class attribute of an element based on some model property, i.e., I wanted to change the class in the corresponding formatter function based on the currently bound value. However, my formatter function is not called. When I use the same syntax on a text attribute, it works.
    I also tried to use normal property binding, but it did not work on the class attribute either (it just put class="{property}" in the rendered HTML).
    Is there anything I missed or is it just not possible to use property binding and calculated field syntax for class attributes? Did anybody try something like this before?
    I think it is a standard use case to change the CSS class based on some model property. So, if anybody knows how to do that, could you give a short example?
    Best regards
    Svenja

    They have a class property. At least, I can do the following in an XML view:
    <Button
                  icon="sap-icon://add"
                  press="onButtonPress"
                  class="my-button-class" />
    I would expect the following to work as well, but for me it did not:
    <Button
                  icon="sap-icon://add"
                  press="onButtonPress"
                  class="{/customClass}" />
    This renders the following HTML (cropped to the important parts):
    <button type="button" class="sapMBtn {/customClass}">
    </button>
    It seems like the class attribute is something special although I don't see a reason why. Other HTML templating engines, for example, support things like that.

  • Getting "Ordinal binding and Named binding cannot be combined" error

    Hello,
    I am getting following exception while calling stored produre:
    *"Ordinal binding and Named binding cannot be combined"*
    I am calling stored procedure with JDBC with 1 input parameter and 1 output parameters as mentioned below:
    CallableStatement collableStat = connection.prepareCall("{ call sp_clnt_intermed_validation(?,?) };
    // Registering In parameters          
    collableStat.setString("p_user_name", "SampleUser");                              
    // Registering Out parameters
    for(String paramKey : paramKeysSet) {                                   
    collableStat.registerOutParameter("p_success_flag", Types.VARCHAR);
    // execute stored procedure
    collableStat.execute();
    Please guide.
    Regards,
    Akshay.
    Edited by: 914678 on Feb 15, 2012 5:48 AM

    Why is the registerOutParameter in a loop?
    You don't state your DB version but as of 10g there is no support for named parameters for a PL/SQL function because there is no 'name' of the returned parameter. So use ordinal indexes for both parameters.
    Instead of
    collableStat.setString("p_user_name", "SampleUser");
    collableStat.registerOutParameter("p_success_flag", Types.VARCHAR);use
    collableStat.setString(1, "SampleUser");
    collableStat.registerOutParameter(2, Types.VARCHAR);Next time post this in the JDBC forum.
    Edited by: rp0428 on Feb 15, 2012 11:48 AM

  • Where to find javax.xml.bind and javax.jdo

    One of my application require import javax.xml.bind and javax.jdo packages. I could not find them. Someone can help to let me know where to download them or they come with some other toll\packages?
    Thanks
    John

    Hi John ,
    I have the same problem: Getting the javax.jdo Packge . . . .(WHERE ?)
    if you found out ow already, please tell me at: [email protected]
    thanks,
    edan

  • Component binding and state saving

    Hello,
    I have a few questions in regards to component binding and state saving (specifically in regards to the reference implementation) when the saving method is client and backing-beans are in the request scope rather than in the session scope:
    1) if a component instance is bound to a backing-bean property then does the state of that component get saved when the view state is saved?
    2) for UIData component, if the component value is bound to a list, does the actual list (after being wrapped) serve as the local data for the component? If this is the case, when the state is saved and then subsequently restored, does the list get re-created with the original number of items?
    Regards,
    Len Takeuchi

    Thanks for the quick response.
    (2) The actual list is not saved; the list will be
    re-queried on subsequent requests.The list composition may have changed by the time the list is re-queried. If the table being displayed is updatable then transfer of information from request back to the list (during Apply Request Values) may not happen properly. So does that pretty much mean that the original list has to be kept around (in the session)? If the state saving method is server then does the saved state maintain a reference to the original list across requests?
    Len Takeuchi

  • Where can I find BIND and C-compiler software

    I just install Solaris 8 on my sunblade, i t will be used as a test DNS server. Does anyone know where can I find/download the BIND and CC software? Is it on the installation CD or do I need to download. Thanks.
    Sonny

    It might be on the "Software Companion" CD in the Bonus Software booklet but gcc & bind are also located at:
    http://sunfreeware.com/
    Click on Sparc/Solaris 8 to see what versions are available.
    Download info & FAQs are in left column.
    John

  • WD Tut18: when to bind and when to addElement() ???

    Hi All,
      I am trying <b>Context Programming and Data Binding (18) tutorial</b>.
      I am slight confused.. when to bind() and when to addElement()'s:
    page 22>>
    newCustomerNodeElement.nodeAddress().bind(newAddressNodeElement);
    page 26>>
    node.addElement(newOrderNodeElement);
    page23 explanation >>
    Note that, if you call the method bind (newCustomerNodeElement) instead of addElement(newCustomerNodeElement), only the last bound node element of the type Customer is contained in the list of node elements. That is, wdContext.nodeCustomers().bind(newCustomerNodeElement) overwrites the list of node elements of the type Customer.
      Is it that .. when the cardinality is 0..1 (or) 1..1>> we have to <b>bind</b> elements and when cardinality 0..n (or) 1..n >> we have to <b>addElement();</b> ??
      Also i didn't get the exact advantage of a supplyFunction.
    Can any1 help me out ?? explain me .. more detailedly ???
    Thank u very much in advance,
    kanth.

    Beginner,
    In general, bind and addElement are interchangeable: you may either bind or addElement.
    For example, if cardinality is 0..1 you may add sole element or bind this element. If the cardinality is 0..n then you may either bind collection of elements or add elements one by one.
    Typically, bind is used when you populate node content initially, addElement is used when user adds/removes already populated node.
    VS

  • Is there a Difference between Binding and Mapping

    Hello together,
    in SAP NetWeaver Library they speak about Data Binding and Mapping
    http://help.sap.com/saphelp_nw70/helpdata/en/77/3545415ea6f523e10000000a155106/frameset.htm
    Is Binding and Mapping the same thing? Or is there any difference?
    Am I right in thinking binding works the following way:
    There´s Context-Element NAME into the Component-Controller-Context,
    a Context-Element NAME into the View-Controller-Context and one UI-Element on my View-Layout.
    In the next step, I bind View-Controller-Context-Element NAME against the Element in the Component-Controller-Context, and the UI-Element against the element into the view controller.
    While runtime, the Context-Element of the Component-Controller-Context gets created.
    Is it right, that because of the binding, all involved Controller-Contexts work on the same reference of the
    data-object, which is behind Context-Element NAME?
    Thank you very much.
    With regards,
    Oliver

    Hi,
    Both are different,binding is between view UI element and view context node/attribute.Mapping is between two controlleres like view controller and component controller.The detailed information is given in the below article about context.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/60730016-dbba-2a10-8f96-9754a865b814
    also check this document about different contrlleres in Web Dynpro for ABAP
    http://help.sap.com/SAPHELP_NW04S/helpdata/EN/b9/b82c4142aef623e10000000a155106/content.htm

  • Difference betwee "Binding" and "Partner Link"

    Hi Forum - Could you please explain the difference between Binding and Partner Link and when to use which one?
    Thanks!

    Thanks for the explanations. Can I create a service with just the SOAP binding without usnig BPEL partner links in Oracle BPEL?
    I have tried this however BPEL is adding a reference to my WSDL and then creating a partner link by itself in the reference binding. How can I stop it from doing that?
    The reason I want to do that is becasue I have a BPEL project which has two processes, which I expose as web sevices by creating the WSDL file manually (not using auto wizard).
    I have deployed this project on weblogic soa domain but its giving me two endpoints for it and two links to wsdl file, one for each process. Is this normal?
    Thanks!

  • Difference between binding and value

    Hi
    I am new to JSF
    Can you tell me what is the difference between binding and value attribute of a
    JSF component ?
    Many thanks.

    Hi,
    the binding is the component association to a managed bean (or backing bean). This allows you to manipulate the component in Java code stored in a managed bean.
    The value is what the actual component value is.
    Frank

Maybe you are looking for

  • Is it possible or could it be possible to install a custom tab in the event repeat in the iCal?

    Basically I work on a shift rota that repeats every 14 weeks.  When plotting my shifts being able to customise the repeat function could be a major advantage.

  • CUCM 7.X version Failed to monitor

    HI CIsco We have cisco callmanager version 7.X in our environment. We have an issue to monitor the server due to our monitoring system was detected it is cisco router 1841. We already turn on the snmp services int the call manager but its show in our

  • CIC win client to web client migration

    Hi all, I am new to CRM CIC. We are on CRM 5.0 and we need to migrate the CIC win client to web client. Can anyone please let me know how should we start. Are there any documents/sequence of steps for the migration? Regards, Nag Reddy

  • New Query:-plz give ans asap

    help ... delete a duplicate rows wid out using rowid and rownum ex table test id name 1 a 1 a 2 b 2 b 3 c 3 c 4 a 4 c use delete statement with out using rowid and rownum such that data become id name 1 a 2 b 3 c 4 c

  • How to increase length in Combobox.

    Hi Everyone, I got some problem;in addition, I have some data(company name) that was too long to put this data in Combobox and it's show error message "Valid Value-Value exceeds the boundaries". How can I slove this ploblem,please help me. Thanks a l