Bulk Binding

The below example is based on an example from Chapter 5 in Release 2 (9.2) documentation (Available in Oracle site).
But it is failing and throwing the following error:
"PLS-00435 DML statement without BULK In-BIND cannot be used inside FORALL".
Can you pl suggest a workaround for this?
CREATE TABLE test_ravi3 (col1 NUMBER, col2 VARCHAR2(20));
CREATE TABLE test_ravi4 (col1 NUMBER, col2 VARCHAR2(20));
INSERT INTO test_ravi3 VALUES(1,'RAVI' );
INSERT INTO test_ravi3 VALUES(2,'RAVI1' );
INSERT INTO test_ravi3 VALUES(3,'RAVI2' );
INSERT INTO test_ravi3 VALUES(4,'RAVI3' );
INSERT INTO test_ravi3 VALUES(5,'RAVI4' );
DECLARE
TYPE RecTabTyp IS TABLE OF test_ravi3%ROWTYPE
INDEX BY BINARY_INTEGER;
TYPE NumTabTyp IS TABLE OF NUMBER
INDEX BY BINARY_INTEGER;
TYPE CharTabTyp IS TABLE OF VARCHAR2(20)
INDEX BY BINARY_INTEGER;
CURSOR c1 IS SELECT col1, col2 FROM test_ravi4;
rec_tab RecTabTyp;
BEGIN
SELECT COL1, COL2 BULK COLLECT INTO REC_TAB FROM TEST_RAVI3
WHERE COL1 < 9;
FORALL I IN REC_TAB.FIRST..REC_TAB.LAST
INSERT INTO TEST_RAVI4 VALUES REC_TAB(I);
FOR I IN REC_TAB.FIRST..REC_TAB.LAST LOOP
REC_TAB(I).COL1 := REC_TAB(I).COL1 + 100;
END LOOP;
FORALL I IN REC_TAB.FIRST..REC_TAB.LAST
UPDATE TEST_RAVI3 SET (COL1 ,COL2) = REC_TAB(I);
OPEN C1;
FETCH C1 BULK COLLECT INTO REC_TAB;
CLOSE C1;
END;

Is block abc based on Table1? If it is, then you should NOT be issuing ANY update sql statements on the table. This just causes problems.
Assuming abc is based on Table1, then the block should contain a text item for all three fields: Field1, col1, and col2. Then all you need is:
Go_block('abc');
first_record;
Loop
  exit when :system.record_status='NEW';
  if :abc.field1 = 'Y' then
    :abc.col1 := value1;
  end if;
  exit when :system.last_record='TRUE';
end loop;
first_record;
commit_form;
Forms will take care of creating and executing the sql update statement, and it will do it using rowid, which is better than "where col2 = :abc.col2;" Also, you will no longer have locking problems.
...However... if abc is based on a table other than Table1, then something like your code is what you need to use. The fastest method of execution would be the bulk binding route, but do it from a package procedure on the database that you call from the form.

Similar Messages

  • Dynamic SQL and Bulk Bind... Interesting Problem !!!

    Hi Forum !!
    I've got a very interesting problem involving Dynamic SQL and Bulk Bind. I really Hope you guys have some suggestions for me...
    Table A contains a column named TX_FORMULA. There are many strings holding expressions like '.3 * 2 + 1.5' or '(3.4 + 2) / .3', all well formed numeric formulas. I want to calculate each formula, finding the number obtained as a result of each calculation.
    I wrote something like this:
    DECLARE
    TYPE T_FormulasNum IS TABLE OF A.TX_FORMULA%TYPE
    INDEX BY BINARY_INTEGER;
    TYPE T_MontoIndicador IS TABLE OF A.MT_NUMBER%TYPE
    INDEX BY BINARY_INTEGER;
    V_FormulasNum T_FormulasNum;
    V_MontoIndicador T_MontoIndicador;
    BEGIN
    SELECT DISTINCT CD_INDICADOR,
    TX_FORMULA_NUMERICA
    BULK COLLECT INTO V_CodIndicador, V_FormulasNum
    FROM A;
    FORALL i IN V_FormulasNum.FIRST..V_FormulasNum.LAST
    EXECUTE IMMEDIATE
    'BEGIN
    :1 := TO_NUMBER(:2);
    END;'
    USING V_FormulasNum(i) RETURNING INTO V_MontoIndicador;
    END;
    But I'm getting the following messages:
    ORA-06550: line 22, column 43:
    PLS-00597: expression 'V_MONTOINDICADOR' in the INTO list is of wrong type
    ORA-06550: line 18, column 5:
    PL/SQL: Statement ignored
    ORA-06550: line 18, column 5:
    PLS-00435: DML statement without BULK In-BIND cannot be used inside FORALL
    Any Idea to solve this problem ?
    Thanks in Advance !!

    Hallo,
    many many errors...
    1. You can use FORALL only in DML operators, in your case you must use simple FOR LOOP.
    2. You can use bind variables only in DML- Statements. In other statements you have to use literals (hard parsing).
    3. RETURNING INTO - Clause in appropriate , use instead of OUT variable.
    4. Remark: FOR I IN FIRST..LAST is not fully correct: if you haven't results, you get EXCEPTION NO_DATA_FOUND. Use Instead of 1..tab.count
    This code works.
    DECLARE
    TYPE T_FormulasNum IS TABLE OF VARCHAR2(255)
    INDEX BY BINARY_INTEGER;
    TYPE T_MontoIndicador IS TABLE OF NUMBER
    INDEX BY BINARY_INTEGER;
    V_FormulasNum T_FormulasNum;
    V_MontoIndicador T_MontoIndicador;
    BEGIN
    SELECT DISTINCT CD_INDICATOR,
    TX_FORMULA_NUMERICA
    BULK COLLECT INTO V_MontoIndicador, V_FormulasNum
    FROM A;
    FOR i IN 1..V_FormulasNum.count
    LOOP
    EXECUTE IMMEDIATE
    'BEGIN
    :v_motto := TO_NUMBER('||v_formulasnum(i)||');
    END;'
    USING OUT V_MontoIndicador(i);
    dbms_output.put_line(v_montoindicador(i));
    END LOOP;
    END;You have to read more about bulk- binding and dynamic sql.
    HTH
    Regards
    Dmytro
    Test table
    a
    (cd_indicator number,
    tx_formula_numerica VARCHAR2(255))
    CD_INDICATOR TX_FORMULA_NUMERICA
    2 (5+5)*2
    1 2*3*4
    Message was edited by:
    Dmytro Dekhtyaryuk

  • ORA-06502: PL/SQL: numeric or value error: Bulk Bind: Truncated Bind

    Hi
    I am getting this run time error ORA-06502: PL/SQL: numeric or value error: Bulk Bind: Truncated Bind in my pl/sql . I tried evrything , changing datatypes ,etc but still this error is coming .What can be the cause , please help.
    declare
    svid xxpor_utility.p_svid@sppmig1%type;
    p_sv_id xxpor_utility.p_svid@sppmig1%type;
    tab xxpor_utility.xxpor_indextab@sppmig1;
    svid1 xxpor_utility.p_svid@sppmig1%type;
    p_sv_id1 xxpor_utility.p_svid@sppmig1%type;
    tab1 xxpor_utility.xxpor_indextab@sppmig1;
    svid2 xxpor_utility.p_svid@sppmig1%type;
    p_sv_id2 xxpor_utility.p_svid@sppmig1%type;
    tab2 xxpor_utility.xxpor_indextab@sppmig1;
    svid3 xxpor_utility.p_svid@sppmig1%type;
    p_sv_id3 xxpor_utility.p_svid@sppmig1%type;
    tab3 xxpor_utility.xxpor_indextab@sppmig1;
    v_index t2_error_table.id_value%type;
    v_code t2_error_table.error_code%type;
    p_error varchar2(600);
    k number(20):=0;
    v_msg varchar2(2000);
    v_commit_count number(10);
    v_at_gpid varchar2(512);
    v_at_oper varchar2(512);
    v_sch varchar2(512);
    v_vat varchar2(512);
    exp exception;
    exp1 exception;
    exp2 exception;
    exp3 exception;
    exp4 exception;
    v_pay varchar2(512);
    v_res varchar2(512);
    v_digit varchar2(512);
    v_agree varchar2(512);
    v_driver_licence PERSON_HISTORY.drivers_licence%TYPE;
    v_cus_gen1 number(10);
    v_cus_gen2 number(10);
    v_cus_gen3 number(10);
    svid_sr number(10);
    v_social PERSON_HISTORY.social_security_number%TYPE;
    CURSOR person_cur (p_person_id person_history.person_id%TYPE)
    IS
    SELECT drivers_licence ,social_security_number
    FROM PERSON_HISTORY@SPPMIG1
    WHERE PERSON_ID=p_person_id --p2(p).person_id
         AND EFFECTIVE_START_DATE = (SELECT MAX(EFFECTIVE_START_DATE)
         FROM PERSON_HISTORY@sppmig1
                                            WHERE PERSON_ID=p_person_id);--p2(p).person_id) ;
    --p number(20):=1;
    --j number(20);
    cursor c1 is
    select * from cus_node_his ;
    type temp_c1 is table of customer_node_history%rowtype
    index by binary_integer;
    t2 temp_c1;
    type temp_c2 is table of customer_node_history@slpmig1%rowtype
    index by binary_integer;
    p2 temp_c2;
    /*cursor c2(p_id customer_query.customer_node_id%type) is
    select general_1,general_2,general_3
    from customer_query@sppmig1 c where c.customer_query_type_id=10003 and
    c.customer_node_id(+) =p_id
    and c.open_date = (select
    max(open_date) from customer_query@sppmig1 where customer_node_id=p_id
    and customer_query_type_id=10003 and c.customer_query_id =(select max(customer_query_id) from customer_query@sppmig1
    where customer_node_id=p_id and customer_query_type_id=10003));*/
    procedure do_bulk_insert is
    bulk_errors EXCEPTION;
    PRAGMA EXCEPTION_INIT(bulk_errors, -24381);
    begin
    forall j in 1..t2.count SAVE EXCEPTIONS
    insert into aaa values t2(j);
    commit;
    --t2.delete;
    k:=0;
    v_msg:=sqlerrm;
    EXCEPTION WHEN bulk_errors THEN
    FOR L IN 1..SQL%bulk_exceptions.count
    LOOP
    v_index := SQL%bulk_exceptions(L).ERROR_INDEX;
    v_code := sqlerrm(-1 * SQL%bulk_exceptions(L).ERROR_CODE);
    --v_index := SQL%bulk_exceptions(j).ERROR_INDEX;
    --v_code := sqlerrm(-1 * SQL%bulk_exceptions(j).ERROR_CODE);
    INSERT INTO t2_error_table
    VALUES('CUSTOMER_NODE_HISTORY',
    'CUSTOMER_NODE_ID',
    v_msg,
    t2(v_index).customer_node_id,
    null,
    'DO_BULK_INSERT',
    v_code
    commit;
    END LOOP;
    end do_bulk_insert;
    begin
    select value into v_at_gpid from t2_system_parameter@sppmig1 where name='atlanta_group_id';
    select value into v_commit_count from t2_system_parameter@sppmig1 where name='batch_size';
    select value into v_sch from t2_system_parameter@sppmig1 where name='schedule_id';
    select value into v_pay from t2_system_parameter@sppmig1 where name='payment_location_code';
    select value into v_at_oper from t2_system_parameter@sppmig1 where name='atlanta_operator_id';
    select value into v_digit from t2_system_parameter@sppmig1 where name='digits_to_be_screened';
    select value into v_res from t2_system_parameter@sppmig1 where name='responsible_agent';
    select value into v_vat from t2_system_parameter@sppmig1 where name='vat_rate';
    select value into v_agree from t2_system_parameter@sppmig1 where name='bank_agreement_status';
    xxpor_utility.xxpor_loadmemory@sppmig1('CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_TYPE_ID',tab);
    xxpor_utility.xxpor_loadmemory@sppmig1('CUSTOMER_NODE_HISTORY','CREDIT_RATING_CODE',tab2);
    xxpor_utility.xxpor_loadmemory@sppmig1('CUSTOMER_NODE_HISTORY','PAYMENT_METHOD_CODE',tab3);
    xxpor_utility.xxpor_loadmemory@sppmig1('CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_STATUS_CODE',tab1);
    open c1;
    loop
    fetch c1 bulk collect into p2 limit v_commit_count;
    for p in 1..p2.count loop
    k:=K+1;
    begin
    xxpor_utility.xxpor_getsvid@sppmig1(p2(p).CUSTOMER_NODE_TYPE_ID,tab,svid);
    p_sv_id:=svid;
    xxpor_utility.xxpor_getsvid@sppmig1(p2(p).CUSTOMER_NODE_STATUS_CODE,tab1,svid1);
    p_sv_id1 :=svid1;
    xxpor_utility.xxpor_getsvid@sppmig1(p2(p).CREDIT_RATING_CODE,tab2,svid2);
    p_sv_id2:=svid2;
    xxpor_utility.xxpor_getsvid@sppmig1(p2(p).PAYMENT_METHOD_CODE,tab3,svid3);
    p_sv_id3:=svid3;
    OPEN person_cur (p2(p).person_id);
    FETCH person_cur INTO v_driver_licence, v_social;
    CLOSE person_cur;
    --select social_security_number  into v_social from person_history@sppmig1 where
    --PERSON_ID=p2(p).person_id AND EFFECTIVE_START_DATE = (SELECT MAX(EFFECTIVE_START_DATE) FROM
    --PERSON_HISTORY@sppmig1 WHERE PERSON_ID=p2(p).person_id) ;
    /*open c2(p2(p).customer_node_id);
    fetch c2 into v_cus_gen1, v_cus_gen2, v_cus_gen3;
    close c2;
    xxpor_utility.get_status_code@sppmig1(v_cus_gen1,v_cus_gen2,v_cus_gen3,svid_sr);*/
    svid_sr:=2600000;
    t2(k).CUSTOMER_NODE_ID     :=     p2(p).CUSTOMER_NODE_ID;
    t2(k).LAST_MODIFIED          :=     p2(p).LAST_MODIFIED;
    t2(k).EFFECTIVE_START_DATE     :=     p2(p).EFFECTIVE_START_DATE;
    t2(k).EFFECTIVE_END_DATE     :=     p2(p).EFFECTIVE_END_DATE;
    t2(k).CUSTOMER_NODE_TYPE_ID     := p_sv_id;
    if p_sv_id is null then
    raise exp1;
    end if;
    t2(k).PRIMARY_IDENTIFIER      :=     p2(p).PRIMARY_IDENTIFIER;
    t2(k).PRIMARY_IDENTIFIER2     :=     p2(p).PRIMARY_IDENTIFIER2;
    t2(k).NODE_NAME           :=     p2(p).NODE_NAME ;
    t2(k).NODE_NAME_UPPERCASE     :=     p2(p).NODE_NAME_UPPERCASE ;
    t2(k).NODE_NAME_SOUNDEX     :=     p2(p).NODE_NAME_SOUNDEX;
    t2(k).ATLANTA_GROUP_ID          := v_at_gpid ;
    t2(k).ATLANTA_OPERATOR_ID     :=     p2(p).ATLANTA_OPERATOR_ID;
    t2(k).GL_CODE_ID          :=     p2(p).GL_CODE_ID;
    t2(k).PARENT_CUSTOMER_NODE_ID     := p2(p).PARENT_CUSTOMER_NODE_ID ;
    t2(k).HIERARCHY_LEVEL          := p2(p).HIERARCHY_LEVEL ;
    t2(k).ROOT_CUSTOMER_NODE_ID      := p2(p).ROOT_CUSTOMER_NODE_ID ;
    t2(k).CUSTOMER_NODE_STATUS_CODE := p_sv_id1 ;
    if p_sv_id1 is null then
    raise exp2;
    end if;
    t2(k).CREATED_DATE     :=          p2(p).CREATED_DATE;
    t2(k).ACTIVE_DATE      :=          p2(p).ACTIVE_DATE ;
    t2(k).PERSON_ID     :=          p2(p).PERSON_ID ;
    t2(k).PRIME_ACCOUNT_ID :=          p2(p).PRIME_ACCOUNT_ID;
    t2(k).REPORT_LEVEL_CODE :=          p2(p).REPORT_LEVEL_CODE;
    t2(k).POSTAL_ADDRESS_ID     :=     p2(p).POSTAL_ADDRESS_ID;
    t2(k).SITE_ADDRESS_ID     :=     p2(p).SITE_ADDRESS_ID ;
    t2(k).CURRENCY_ID      :=          p2(p).CURRENCY_ID;
    t2(k).SCHEDULE_ID     :=          v_sch;
    t2(k).BILLING_PRIORITY     :=     p2(p).BILLING_PRIORITY ;
    t2(k).BILLING_COMPLEXITY:=          p2(p).BILLING_COMPLEXITY ;
    t2(k).BILLING_CONFIGURATION_CODE     := p2(p).BILLING_CONFIGURATION_CODE;
    t2(k).SUPPRESS_IND_CODE           := p2(p).SUPPRESS_IND_CODE ;
    t2(k).SUPPRESS_BILL_CYCLE_COUNT := p2(p).SUPPRESS_BILL_CYCLE_COUNT;
    t2(k).SUPPRESS_UNTIL_ISSUE_DATE := p2(p).SUPPRESS_UNTIL_ISSUE_DATE;
    t2(k).TURNOVER               := p2(p).TURNOVER;
    t2(k).TURNOVER_CURRENCY_ID      :=     p2(p).TURNOVER_CURRENCY_ID ;
    t2(k).CREDIT_LIMIT           :=     p2(p).CREDIT_LIMIT ;
    t2(k).CREDIT_LIMIT_CURRENCY_ID :=     p2(p).CREDIT_LIMIT_CURRENCY_ID;
    t2(k).EXPECTED_REVENUE      :=     p2(p).EXPECTED_REVENUE ;
    t2(k).EXPECTED_REVENUE_CURRENCY_ID     := p2(p).EXPECTED_REVENUE_CURRENCY_ID ;
    t2(k).CREDIT_RATING_CODE      :=     p_sv_id2 ;
    -- if p_sv_id2 is null then
    --raise exp3;
    -- end if;
    t2(k).CREDIT_COMMENTS           := p2(p).CREDIT_COMMENTS ;
    t2(k).TAX_CLASS_CODE          := 1     ;
    t2(k).PAYMENT_METHOD_CODE     :=     p_sv_id3;
    --if p_sv_id3 is null then
    --raise exp4;
    --end if;
    t2(k).PAYMENT_LOCATION_CODE      := v_pay ;
    t2(k).BANK_CODE           :=     NULL;
    t2(k).BRANCH_CODE           :=     NULL ;
    t2(k).BANK_ACCOUNT_NAME     :=     p2(p).NODE_NAME ;
    t2(k).BANK_ACCOUNT_NUMBER     :=     '1000000';
    t2(k).BANK_ACCOUNT_REF      :=     v_agree;
    t2(k).CARD_TYPE_CODE          := p2(p).CARD_TYPE_CODE     ;
    t2(k).CARD_NUMBER          :=     p2(p).CARD_NUMBER ;
    t2(k).CARD_EXPIRY_DATE          := NULL ;
    t2(k).ASSIGNED_OPERATOR_ID      :=     NULL ;
    t2(k).SALES_CHANNEL_CODE     :=     0;
    t2(k).COMPANY_NUMBER          := NULL;
    t2(k).INDUSTRY_CODE          :=     NULL;
    t2(k).REGION_CODE           :=     NULL;
    t2(k).GENERAL_1          :=     v_vat ;
    t2(k).GENERAL_2           :=     svid_sr ;
    if svid_sr is null then
    raise exp;
    end if;
    t2(k).GENERAL_3           :=     v_social ;
    t2(k).GENERAL_4           :=     v_driver_licence ;
    t2(k).GENERAL_5           :=     v_vat;
    t2(k).GENERAL_6           :=     v_res;
    t2(k).GENERAL_7           :=     null||':'||null||':'||'1000000'||':'||null||':'||null||':'||null||':';
    t2(k).GENERAL_8          :=     '2' ;
    t2(k).GENERAL_9           :=     v_digit;
    t2(k).GENERAL_10          :=     p2(p).CUSTOMER_NODE_ID;
    exception when exp then
    p_error:= sqlerrm;
    insert into t2_error_table values ( 'CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_ID',p_error,p2(p).customer_node_id
    ,null,null,null);
    commit;
    when exp1 then
    p_error:= sqlerrm;
    insert into t2_error_table values ( 'CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_ID',p_error,p2(p).customer_node_id
    ,null,null,'customer_node_type_id is null');
    commit;
    when exp2 then
    p_error:= sqlerrm;
    insert into t2_error_table values ( 'CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_ID',p_error,p2(p).customer_node_id
    ,null,null,'customer_node_status_code is null');
    commit;
    /*when exp3 then
    p_error:= sqlerrm;
    insert into t2_error_table values ( 'CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_ID',p_error,p2(p).customer_node_id
    ,null,null,'credit_rating_code is null');
    commit;
    when exp4 then
    p_error:= sqlerrm;
    insert into t2_error_table values ( 'CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_ID',p_error,p2(p).customer_node_id
    ,null,null,null);
    commit;*/
    when others then
    p_error:= sqlerrm;
    insert into t2_error_table values ( 'CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_ID',p_error,p2(p).customer_node_id
    ,null,null,null);
    commit;
    end;
    if mod(k,v_commit_count)=0 then
    do_bulk_insert;
    t2.delete;
    end if;
    end loop;
    do_bulk_insert;
    exit when c1%notfound;
    end loop;
    t2.delete;
    exception when others then
    p_error:= sqlerrm;
    insert into t2_error_table values ( 'CUSTOMER_NODE_HISTORY','CUSTOMER_NODE_ID',p_error,null
    ,null,null,null);
    commit;
    RAISE;
    end;
    /

    Hi there,
    Following is the description of the error, you are getting.
    ORA-06502:VALUE_ERROR
    An arithmetic, conversion, truncation, or size-constraint error occurs. For example, when your program selects a column value into a character variable, if the value is longer than the declared length of the variable, PL/SQL aborts the assignment and raises VALUE_ERROR. In procedural statements, VALUE_ERROR is raised if the conversion of a character string into a number fails. (In SQL statements, INVALID_NUMBER is raised.)
    Hopefully this will help.

  • Accessing the index in bulk binds

    Hi
    I wonder if it is possible to access the index itself in a bulk bind. For instance:
    SQL> desc draft_responces;
    Name Type Nullable Default Comments
    S_NUMBER VARCHAR2(10)
    CLUSTER_ID NUMBER
    STATEMENT_ID NUMBER
    RESPONCE NUMBER Y
    RESP_NUM NUMBER Y
    and I wished to insert the responce number i into the resp_num:
    forall i in indices of p_statement_ids
    insert into draft_responces
    s_number
    ,cluster_id
    ,statement_id
    ,responce
    ,resp_num)
    values (
    p_snumber
    ,p_cluster_id
    ,p_statement_ids(i)
    ,p_responces(i)
    , i );
    which fails ... is it possible to access the index i in a bulk bind explicitly?
    thanks

    You're in the wrong forum (this one is for issues with the SQL Developer tool). You'll get more answers in the SQL And PL/SQL forum.
    Have fun,
    K.

  • Bulk Binds-How to avoid naming all columns?

    When using Bulk Binds for inserts/updates,One has to explicitly use all column names in declaration.This is maint intensive as
    addition of any colum will require changes in code at multiple locations.
    Is there any way to reference the columns though other means(such as records)?
    thanks

    Zia wrote:
    1) I have a detail report which contains more than 100 thousands rows. This report is already on menu and available to users. User have got an option on menu that they can select output either 'screen' or 'spreadsheet'. If user select option as 'spreadsheet', report open in excel file but in old excel and truncating excessive rows as .xls have limitation of maximum 65 thousands rows. I do not want to use 'csv' format as directly conversion into excel is more convinient for users. If report contains less than 65 thousands rows then everything is fine and no issues with the report. I hope I could explain real problem this time.65 thousands rows is the limitation of that version u use. I use Microsoft Office 2010 where limitation is 1048576 is a sheet.
    One solution is uninstall the present Office version and use Office 2010.
    2) Regarding second point, I have a summary report which is all fine and showing desired output in desired format. But when user want output in excel file, some of report columns occupy more than one columns and causing difficulties for users. Actually users do need to convert few reports into excel and work with formulas in excel but in this situation they have to do lots of changes in format before applying formulas. A sample screen shot of a report and converted report in excel file both can be seen on this link [https://skydrive.live.com/?cid=573511bde4261fe6#cid=573511BDE4261FE6&id=573511BDE4261FE6%21120]
    I'm not sure about the solution. Most probably you have more space in repeating frame and cause this thing happen. shorter the space in the frame and try.
    Hope this will help you.

  • Bulk Binding-How to avoid naming all columns

    When using Bulk Binds for inserts/updates,One has to explicitly use all column names in declaration.This is maint intensive as
    addition of any colum will require changes in code at multiple locations.
    Is there any way to reference the columns though other means(such as records)?
    thanks

    Zia wrote:
    1) I have a detail report which contains more than 100 thousands rows. This report is already on menu and available to users. User have got an option on menu that they can select output either 'screen' or 'spreadsheet'. If user select option as 'spreadsheet', report open in excel file but in old excel and truncating excessive rows as .xls have limitation of maximum 65 thousands rows. I do not want to use 'csv' format as directly conversion into excel is more convinient for users. If report contains less than 65 thousands rows then everything is fine and no issues with the report. I hope I could explain real problem this time.65 thousands rows is the limitation of that version u use. I use Microsoft Office 2010 where limitation is 1048576 is a sheet.
    One solution is uninstall the present Office version and use Office 2010.
    2) Regarding second point, I have a summary report which is all fine and showing desired output in desired format. But when user want output in excel file, some of report columns occupy more than one columns and causing difficulties for users. Actually users do need to convert few reports into excel and work with formulas in excel but in this situation they have to do lots of changes in format before applying formulas. A sample screen shot of a report and converted report in excel file both can be seen on this link [https://skydrive.live.com/?cid=573511bde4261fe6#cid=573511BDE4261FE6&id=573511BDE4261FE6%21120]
    I'm not sure about the solution. Most probably you have more space in repeating frame and cause this thing happen. shorter the space in the frame and try.
    Hope this will help you.

  • PL/SQL: numeric or value error: Bulk bind: Error in define

    Hello
    Does anyone know what this error means?
    PL/SQL: numeric or value error: Bulk bind: Error in define
    I've checked the cursor and all of the columns are correct.
    Any help would be greatly appreciated as this is quite urgent.
    Cheers
    David

    Hello
    Here's the top of the function. The exception is thrown on the FETCH...BULK COLLECT line.
    FUNCTION f_ps_insert_jlines(ac_JournalRows     IN sys_refcursor,
                                            an_StartLn          IN OUT INTEGER,
                                            at_Monetary          IN OUT pt_monetary_amount,
                                            at_Stats          IN OUT pt_statistics_amount
                                            ) RETURN INTEGER
         IS
              l_jrnl_id                         pt_jrnl_id;
              l_jrnl_line                         pt_jrnl_line;
              l_jrnl_date                         pt_jrnl_date;
              l_Ps_Account                    pt_ps_account;
              l_ps_dept_id                    pt_ps_dept_id;
              l_ps_product                    pt_ps_product;
              l_ps_project_id                    pt_ps_project_id;
              l_statistics_code               pt_statistics_code;
              l_jrnl_ln_ref                    pt_jrnl_ln_ref;
              l_line_desc                         pt_line_desc;
              ln_Index                         INTEGER;
         BEGIN
              FETCH ac_JournalRows BULK COLLECT INTO
                                                           l_jrnl_id,
                                                           l_jrnl_line,
                                                           l_jrnl_date,
                                                           l_Ps_Account,
                                                           l_ps_dept_id,
                                                           l_ps_product,
                                                           l_ps_project_id,
                                                           l_statistics_code,
                                                           at_monetary,
                                                           at_stats,
                                                           l_jrnl_ln_ref,
                                                           l_line_desc;And here is the top of the cursor....
    SELECT
                                                      l_char_jrnl_id                         AS journal_id,
                                                     ROWNUM + l_jrnl_Line               AS journal_ln,
                                                      lcr_Journal_Header.Journal_Dt      AS journal_dt,
                                                      ps_account,
                                                      ps_dept_id,
                                                      ps_product,
                                                      ps_project_id,
                                                      statistics_code,
                                                      monetary_amount,
                                                      statistics_amount,
                                                      jrnl_ln_ref,
                                                      line_desc
                                                FROMAny ideas?
    Cheers
    David
    p.s. No idea what has happened to the formatting!

  • Error Message - ORA-06502: PL/SQL: numeric or value error: Bulk Bind: Trunc

    This is driving me nuts!
    I am getting this error from OWB during a mapping process.
    I have checked the input data and it looks fine.
    The run time audit browser just lists all of the steps but does not make it clear which one failed. Is it the last one which is shown (does not have HIDE as selection link.)
    I also tried to determine which row was causing the problem and followed the instructions at http://www.nicholasgoodman.com/bt/blog/2005/07/, but no row_id was recorded in the views. In actual fact there wasn't very much audit info other than that the mapping ran and was complete (even though it failed).
    In the error message section it has, in order
    Map Step - blank
    Rowkey - 35204435256
    Severity - X
    Error Message - ORA-06502: PL/SQL: numeric or value error: Bulk Bind: Truncated Bind
    Object Name - N/A
    Object Column - *
    From the PL/SQL error I thought it may be trying to insert into a data field that was too small, but all of the columns that are used are full of data of length shorter than all of the target tables.
    I have even started running the cursors in the generated PLSQL but I don't get the error by doing this.
    Thanks in advance for any tips at all.

    Thanks for the response.
    I managed to work it out and it had to do with the selection criteria of one of the filters.
    For anyone else facing this error, check to see if any of the rows being inserted has the same key/identifier as some existing in the target table. If so add an extra condition to the where clause.
    This worked for me.

  • ORA-06502: PL/SQL: numeric or value error: Bulk Bind: Truncated Bink

    I have a map which worked fine in 10.2.0.1. The same map in 11.2.0.2 is giving me the error:
    'ORA-06502: PL/SQL: numeric or value error: Bulk Bind: Truncated Bink.'
    I have one source and one target. This is a straight load, no transformations.
    While debugging the map I have noticed the culprit is one column in the source which is varchar2(30),
    I have the target column with the same varchar2(30), and I tried increasing the size of
    the target column but i keep getting the same error. While searching the forum someone suggested
    to change the configuration of code generation options and runtime parameters to set based.
    But strangely it gave me an error because the set based option is not availabe in the new 11.2.0.2.
    Should the set based option be available in this version. Please suggest on how i could resolve the
    error of 'ORA-06502: PL/SQL: numeric or value error: Bulk Bind: Truncated Bink.' Thank you.

    Hi there,
    Following is the description of the error, you are getting.
    ORA-06502:VALUE_ERROR
    An arithmetic, conversion, truncation, or size-constraint error occurs. For example, when your program selects a column value into a character variable, if the value is longer than the declared length of the variable, PL/SQL aborts the assignment and raises VALUE_ERROR. In procedural statements, VALUE_ERROR is raised if the conversion of a character string into a number fails. (In SQL statements, INVALID_NUMBER is raised.)
    Hopefully this will help.

  • No performance improvement with  Bulk Binding

    Hi All,
    I need to update 0.2 million rows in (t_shdr_trx_stg ), previously it was... FOR loop..I converted it to bulk binding... but i can can hadrly see any improvement....
    Any clue I am missing something...please check my code snippet
    Cursor
    M I missing something
    Edited by: user8650395 on Nov 28, 2009 6:00 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Just a blind Shot
    FETCH  cur_tsts BULK COLLECT INTO v_cur_tsts LIMIT 1000; /*changed 400000 to 1000*/
    --PLease try thisThese Links will tell you my reasoning for that above suggestion
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:177628700346350496
    and
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1583402705463
    and
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:5918938803188
    Cheers!!!
    Bhushan
    Edited by: Buga --Added Links                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Question regarding bulk binding

    Gurus,
    How does oracle try to differentiate whether the query should use the concept of bulk binding and a normal query ? Is the key word FOR ALL makes the difference ? Or is there any other difference ??
    Please help
    Regards

    Its not up to oracle to decide, Its the developer who decides it. Bulk bind is used to reduce context switch. And you can achieve it with some of the bulk bind utilities provided by oracle like FORALL and BULK COLLECT.
    Read [Overview of Bulk Binds|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_packages.htm#sthref853] for more info.
    Thanks,
    Karthick.

  • What is bulk binding....?

    Hi
    any can pls explain what is bulk binding...?
    thanks in adv.
    KK

    Q: what is bulk bind?
    A: Something that can be looked up in the documentation.
    Cheers, APC

  • Bulk binding in 11g

    Hello,
    My below block works perfectly fine. However the processing takes longer time because of the volume of
    records in the table. I would like to change this below code to use FORALL.
    How can I convert the code to use bulk binding FORALL instead of 'For'.
    Declare
    Cursor  C1 Is Select
    a.old_transaction_id from
    Ideaal_Cons.Tb_Prchs_Sale_Trans_Base A
    where Rownum < 10;
    Type C_Typ Is Table Of C1%Rowtype Index By Pls_Integer;
    C_Rectype C_Typ;
    Type Tab_Desc Is Table Of Ideaal_Cons.Tb_Bookkeeping_Trans_Base.Desc_Line1%Type;
    Type Tab_Nbr Is Table Of Number;
      V_Desc_Tab Tab_Desc;
      V_Nbr      Tab_Nbr; 
      V_Desc_Line1 Varchar2(50);
      V_Desc_Line2 Varchar2(50);
      V_Desc_Line3 Varchar2(50);
      V_Desc_Line4 Varchar2(50);
      V_Desc_Line5 Varchar2(50);
      V_Desc_Line6 Varchar2(50);
      V_Desc_Line7 Varchar2(50);
      V_Desc_Line8 Varchar2(50);
      a number;
      V_Rec Number :=0;
      V_User Varchar2(20) := 'Sisadmin';
    Begin
       Dbms_Output.Enable;
       Open C1;
       Loop
       Fetch C1 Bulk Collect Into C_Rectype Limit 500;
        if C_Rectype.COUNT > 0 THEN
           FOR i IN C_Rectype.FIRST..C_Rectype.LAST
           loop
         Select Line_No,
                Desc_Line
          Bulk Collect Into
              V_Nbr, V_Desc_Tab
          From Ideaal_Staging.Tb_Sisadmin_Trade_Descr
          Where Transaction_Id = C_Rectype(I).Old_Transaction_Id
             Union All
             Select Null As Line_No, Null As Desc_Line From Dual
          Union All
          Select Null As Line_No, Null As Desc_Line From Dual
          Union All
          Select Null As Line_No, Null As Desc_Line From Dual
          Union All
          Select Null As Line_No, Null As Desc_Line From Dual
          Union All
          Select Null As Line_No, Null As Desc_Line From Dual
          Union All
          Select Null As Line_No, Null As Desc_Line From Dual
          Union All
          Select Null As Line_No, Null As Desc_Line From Dual
          Union All
          Select Null As Line_No, Null As Desc_Line From Dual
          Order By Line_No Asc
              V_Desc_Line1 := V_Desc_Tab(1);
              V_Desc_Line2 := V_Desc_Tab(2);
              V_Desc_Line3 := V_Desc_Tab(3);
              V_Desc_Line4 := V_Desc_Tab(4);
              V_Desc_Line5 := V_Desc_Tab(5);
              V_Desc_Line6 := V_Desc_Tab(6);
              V_Desc_Line7 := V_Desc_Tab(7);
              V_Desc_Line8 := V_Desc_Tab(8);
         Update Ideaal_Cons.Tb_Prchs_Sale_Trans_Base
            Set
              Desc_Line1  = V_Desc_Line1,
              Desc_Line2  = V_Desc_Line2,          
              Desc_Line3  = V_Desc_Line3,          
              Desc_Line4  = V_Desc_Line4,          
              Desc_Line5  = V_Desc_Line5,          
              Desc_Line6  = V_Desc_Line6,          
              Desc_Line7  = V_Desc_Line7,          
              Desc_Line8  = V_Desc_Line8
         Where Old_Transaction_Id = C_Rectype(I).Old_Transaction_Id;
         end loop;
       END IF;
         V_Rec := V_Rec + Nvl(C_Rectype.Count,0);
            Commit;
        Exit When C_Rectype.Count = 0;
    End Loop;
    Dbms_Output.Put_Line('Total Rec updated To Trade Table :- '|| V_Rec);
    End;
    /

    Cool stuff, so you should be able to read through that link and implement the update in that manner if you have issues running the single update command.
    As best i can tell, this works for your needs ... again, i don't know your data so you may have to muddle with it a bit. If you need help with that you will have to start showing your data and explaining "why" or "how" it doesn't fit your requirement.
    TUBBY_TUBBZ?drop table Tb_Prchs_Sale_Trans_Base;
    Table dropped.
    Elapsed: 00:00:00.06
    TUBBY_TUBBZ?drop table Tb_Sisadmin_Trade_Descr;
    Table dropped.
    Elapsed: 00:00:00.01
    TUBBY_TUBBZ?
    TUBBY_TUBBZ?create table Tb_Prchs_Sale_Trans_Base
      2  (
      3     Transaction_Id       number,
      4     Old_Transaction_Id   number,
      5     desc_line1           varchar2(10),
      6     desc_line2           varchar2(10),
      7     desc_line3           varchar2(10),
      8     desc_line4           varchar2(10),
      9     desc_line5           varchar2(10),
    10     desc_line6           varchar2(10),
    11     desc_line7           varchar2(10),
    12     desc_line8           varchar2(10)
    13  );
    Table created.
    Elapsed: 00:00:00.01
    TUBBY_TUBBZ?
    TUBBY_TUBBZ?insert into Tb_Prchs_Sale_Trans_Base (Transaction_Id, Old_Transaction_Id) values (998, 1);
    1 row created.
    Elapsed: 00:00:00.00
    TUBBY_TUBBZ?insert into Tb_Prchs_Sale_Trans_Base (Transaction_Id, Old_Transaction_Id) values (999, 2);
    1 row created.
    Elapsed: 00:00:00.00
    TUBBY_TUBBZ?
    TUBBY_TUBBZ?
    TUBBY_TUBBZ?create table Tb_Sisadmin_Trade_Descr
      2  (
      3     Transaction_Id number,
      4     line_nbr       number,
      5     desc_line      varchar2(10)
      6  );
    Table created.
    Elapsed: 00:00:00.00
    TUBBY_TUBBZ?
    TUBBY_TUBBZ?insert into Tb_Sisadmin_Trade_Descr values (1, 1, 'line1');
    1 row created.
    Elapsed: 00:00:00.01
    TUBBY_TUBBZ?insert into Tb_Sisadmin_Trade_Descr values (1, 2, 'line2');
    1 row created.
    Elapsed: 00:00:00.00
    TUBBY_TUBBZ?insert into Tb_Sisadmin_Trade_Descr values (1, 3, 'line3');
    1 row created.
    Elapsed: 00:00:00.01
    TUBBY_TUBBZ?
    TUBBY_TUBBZ?insert into Tb_Sisadmin_Trade_Descr values (2, 4, 'line4');
    1 row created.
    Elapsed: 00:00:00.00
    TUBBY_TUBBZ?insert into Tb_Sisadmin_Trade_Descr values (2, 5, 'line5');
    1 row created.
    Elapsed: 00:00:00.00
    TUBBY_TUBBZ?
    TUBBY_TUBBZ?
    TUBBY_TUBBZ?update Tb_Prchs_Sale_Trans_Base tgt
      2     set
      3        (desc_line1, desc_line2, desc_line3, desc_line4, desc_line5, desc_line6, desc_line7, desc_line8)
      4     =
      5     (
      6        select
      7           max(decode(line_nbr, 1, desc_line)),
      8           max(decode(line_nbr, 2, desc_line)),
      9           max(decode(line_nbr, 3, desc_line)),
    10           max(decode(line_nbr, 4, desc_line)),
    11           max(decode(line_nbr, 5, desc_line)),
    12           max(decode(line_nbr, 6, desc_line)),
    13           max(decode(line_nbr, 7, desc_line)),
    14           max(decode(line_nbr, 8, desc_line))
    15        from
    16           Tb_Sisadmin_Trade_Descr src
    17        where
    18           src.Transaction_Id   = tgt.Old_Transaction_Id
    19     );
    2 rows updated.
    Elapsed: 00:00:00.01
    TUBBY_TUBBZ?select * from Tb_Prchs_Sale_Trans_Base;
        TRANSACTION_ID OLD_TRANSACTION_ID DESC_LINE1                     DESC_LINE2                     DESC_LINE3                     DESC_LINE4                     DESC_LINE5                     DESC_LINE6                     DESC_LINE7                     DESC_LINE8
                   998                  1 line1                          line2                          line3
                   999                  2                                                                                              line4                          line5
    2 rows selected.
    Elapsed: 00:00:00.00
    TUBBY_TUBBZ?

  • Bulk Binding Drawback

    Hi All,
    Seems that Bulk binding of pl/sql do enhance performance, but have no information about its drawback. Does anyone know what drawback that bulk binding have? Thank you.
    CH.

    The only drawback I am aware of is that in some circumstances, using bind variables may cause the optimizer to choose a sub-optimal plan for a query.
    Say you have a table with 1,000,000 rows. 900,000 rows have the value 1 in an indexed column, and the other 100,000 have unique values.
    Clearly, if you issue something like:
    SELECT *
    FROM table
    WHERE indexed_column = 256you would want to use an index. However, if you are looking for indexed_column = 1, then a Full Table Scan would be more efficient. With bind variables, Oracle (prior to 91) will most likely choose the FTS route because of the statisitics. However, if you always query on the unique values, that is not the right plan. In 9i the optimizer "peeks" at the bind variable the first time the statement is parsed and chooses the plan based on that value. In this case, if you always query on the unique values, Oracle is much more likely to get the "correct" plan.
    HTH
    John

  • Explicit access of the index in bulk bind forall

    Hi
    I wonder if it is possible to access the index itself in a bulk bind. For instance:
    SQL> desc draft_responces;
    Name Type Nullable Default Comments
    S_NUMBER VARCHAR2(10)
    CLUSTER_ID NUMBER
    STATEMENT_ID NUMBER
    RESPONCE NUMBER Y
    RESP_NUM NUMBER Y
    and I wished to insert the responce number i into the resp_num:
    forall i in indices of p_statement_ids
    insert into draft_responces
    s_number
    ,cluster_id
    ,statement_id
    ,responce
    ,resp_num)
    values (
    p_snumber
    ,p_cluster_id
    ,p_statement_ids(i)
    ,p_responces(i)
    , i );
    which fails ... is it possible to access the index i in a bulk bind explicitly?
    thanks

    finophile wrote:
    Hi
    I wonder if it is possible to access the index itself in a bulk bind. For instance:
    SQL> desc draft_responces;
    Name Type Nullable Default Comments
    S_NUMBER VARCHAR2(10)
    CLUSTER_ID NUMBER
    STATEMENT_ID NUMBER
    RESPONCE NUMBER Y
    RESP_NUM NUMBER Y
    and I wished to insert the responce number i into the resp_num:
    forall i in indices of p_statement_ids
    insert into draft_responces
    s_number
    ,cluster_id
    ,statement_id
    ,responce
    ,resp_num)
    values (
    p_snumber
    ,p_cluster_id
    ,p_statement_ids(i)
    ,p_responces(i)
    , i );
    which fails ... is it possible to access the index i in a bulk bind explicitly?
    thanksHi,
    according to the documentation index is the "Name for the implicitly declared integer variable that is local to the FORALL statement. Statements outside the FORALL statement cannot reference index. Statements inside the FORALL statement can reference index as an index variable, *but cannot use it in expressions* or change its value. After the FORALL statement runs, index is undefined."
    So it appears the answer is no. You can get around this by using an ordinary for loop, though you don't get the benefit of bulk operations.
    Andre

Maybe you are looking for

  • Exception running FML32 sample app.

    Hi, I configured the WTC with weblogic6.1 and tuxedo7.1. I have two sample services running in tuxedo TOUPPER REVERSE_STRING I compiled the ejb classes provided for simapapp and it ran successfully. However when I try to run the simpFML32 example, I

  • Music interrupts while listening to wireless speakers via Airport Express

    I live in an apartment building with many wi-fi connections all around me. When I listen to music via iTunes, I am regularly prompted with the following message: An error occurred while connecting to the remote speaker "Home", that's the name of my A

  • Since Win 8.1 update Satellite C855-2HW shuts off

    Greetings, Well, June 2013 I bought my Satellite C855-2HW with Windows 8 as operating system. The notebook worked smooth until in December 2013 I got Windows 8.1 updates. Since then every day (sometimes several times a day) the notebook shuts off, th

  • Deleted com.apple.windowserver restore

    I deleted the plist files that people have said to delete to fix my HDMI connection to the TV (I won a Macbook Pro Retina). The problem with this is that when I was going to reboot my computer, it wouldn't start again. It is stuck on loading screen a

  • Doubt in case of Down payment made

    Dear Experts, My client is doing a Downpayment against a PO for Asset wherein I had config  the asset class for Downpayment transation type 15 in SPRO But I am not understanding what General Ledger Account I should give for Down payment in AO90 as th