Save Exception

I have used save exception in a FORALL statement and the common error I return is ORA-20000.
However I get no associated error code. Is this becvause the error is user defined in the db?
The exception handler is as follows is as follows:
WHEN bulk_errors THEN
FOR j IN 1 .. SQL%BULK_EXCEPTIONS.COUNT
LOOP
dbms_output.put_line
('Error ' || j || ' at iteration ' ||SQL%BULK_EXCEPTIONS(j).ERROR_INDEX || ' desc ' ||pono_tab(SQL%BULK_EXCEPTIONS(j).ERROR_INDEX)||'/'||poli_tab(SQL%BULK_EXCEPTIONS(j).ERROR_INDEX));
dbms_output.put_line(' OR Err ' ||SQLERRM(-1 * SQL%BULK_EXCEPTIONS(j).ERROR_CODE));
END LOOP;

I suppose that's what I should be trying to track down...where the error is actually occurring!!
Thanks for your interest.
I will try and run the update without the bulk bind and see if the error stack is more informative.
PS.
The application is riddled with inconsistancies in how errors are handled so I am not holding out much hope!!

Similar Messages

  • How to handle multiple save exceptions (Bulk Collect)

    Hi
    How to handle Multiple Save exceptions? Is it possible to rollback to first deletion(of child table) took place in the procedure.
    There are 3 tables
    txn_header_interface(Grand Parent)
    orders(parent)
    order_items (Child)
    One transaction can have one or multiple orders in it.
    and one orders can have one or multiple order_items in it.
    We need to delete the data from child table first then its parent and then from the grand parent table.if some error occurs anywhere I need to rollback to child record deletion. Since there is flag in child table which tells us when to delete data from database.
    Is it possible to give name to Save exceptions?
    e.g.
    FORALL i IN ABC.FIRST..ABC.LAST SAVE EXCEPTIONS A
    FORALL i IN abc.FIRST..ABC.LAST SAVE EXCEPTIONS B
    if some error occurs then
    ROLLBACK A; OR ROLLBACK B;
    Please find the procedure attached
    How to handle the errors with Save exception and rollback upto child table deletion.
    CREATE OR REPLACE
    PROCEDURE DELETE_CONFIRMED_DATA IS
    TYPE TXN_HDR_INFC_ID IS TABLE OF TXN_HEADER_INTERFACE.ID%TYPE;
    TXN_HDR_INFC_ID_ARRAY TXN_HDR_INFC_ID;
    ERROR_COUNT NUMBER;
    BULK_ERRORS EXCEPTION;
    PRAGMA exception_init(bulk_errors, -24381);
    BEGIN
    SELECT THI.ID BULK COLLECT
    INTO TXN_HDR_INFC_ID_ARRAY
    FROM TXN_HEADER_INTERFACE THI,ORDERS OS,ORDER_ITEMS OI
    WHERE THI.ID = OS.TXN_HDR_INFC_ID
    AND OS.ID = OI.ORDERS_ID
    AND OI.POSTING_ITEM_ID = VPI.ID
    OI.DW_STATUS_FLAG =4 --data is moved to Datawarehouse
    MINUS
    (SELECT THI.ID FROM TXN_HEADER_INTERFACE THI,ORDERS OS,ORDER_ITEMS OI
    WHERE THI.ID = OS.TXN_HDR_INFC_ID
    AND OS.ID = OI.ORDERS_ID
    OI.DW_STATUS_FLAG !=4);
    IF SQL%NOTFOUND
    THEN
    EXIT;
    END IF;
    FORALL i IN TXN_HDR_INFC_ID_ARRAY.FIRST..TXN_HDR_INFC_ID_ARRAY.LAST SAVE
    EXCEPTIONS
    DELETE FROM ORDER_ITEMS OI
    WHERE OI.ID IN (SELECT OI.ID FROM ORDER_ITEMS OI,ORDERS
    OS,TXN_HEADER_INTERFACE THI
    WHERE OS.ID = OI.ORDERS_ID
    AND OS.TXN_HDR_INFC_ID = THI.ID
    AND THI.ID = TXN_HDR_INFC_ID_ARRAY(i));
    FORALL i IN TXN_HDR_INFC_ID_ARRAY.FIRST..TXN_HDR_INFC_ID_ARRAY.LAST SAVE
    EXCEPTIONS
    DELETE FROM ORDERS OS
    WHERE OS.ID IN (SELECT OS.ID FROM ORDERS OS,TXN_HEADER_INTERFACE THI
    WHERE OS.TXN_HDR_INFC_ID = THI.ID
    AND THI.ID = TXN_HDR_INFC_ID_ARRAY(i));
    FORALL i IN TXN_HDR_INFC_ID_ARRAY.FIRST..TXN_HDR_INFC_ID_ARRAY.LAST SAVE
    EXCEPTIONS
    DELETE FROM TXN_HEADER_INTERFACE THI
    WHERE THI.ID = TXN_HDR_INFC_ID_ARRAY(i);
    COMMIT;
    DBMS_OUTPUT.PUT_LINE(TO_CHAR(SYSDATE, 'DD-MON-YY HH:MIPM')||':
    DELETE_CONFIRMED_DATA: INFO:DELETION SUCCESSFUL');
    EXCEPTION
    WHEN OTHERS THEN
    ERROR_COUNT := SQL%BULK_EXCEPTIONS.COUNT;
    DBMS_OUTPUT.PUT_LINE(TO_CHAR(SYSDATE, 'DD-MON-YY HH:MIPM')||':
    DELETE_CONFIRMED_DATA: ERROR:Number of errors is ' ||ERROR_COUNT);
    FOR indx IN 1..ERROR_COUNT LOOP
    DBMS_OUTPUT.PUT_LINE('Error ' || indx || 'occurred during
    '||'iteration'||SQL%BULK_EXCEPTIONS(indx).ERROR_INDEX);
    DBMS_OUTPUT.PUT_LINE('Error is '
    ||SQLERRM(-SQL%BULK_EXCEPTIONS(indx).ERROR_CODE));
    END LOOP;
    END DELETE_CONFIRMED_DATA;
    Any suggestion would be of great help.
    Thanks in advance
    Anu

    If you have one or two places in your code that need multiple exceptions, just do it with multiple catch statements. Unless you are trying to write the most compact Programming 101 homework program, inventing tricks to remove two lines of code is not good use of your time.
    If you have multiple catches all over your code it could be a code smell. You may have too much stuff happening inside one try statement. It becomes hard to know what method call throws one of those exceptions, and you end up handling an exception from some else piece of code than what you intended. E.g. you mention NumberFormatException -- only process one user input inside that try/catch so it is easy to see what error message is given if that particular input is gunk. The next step of processing goes inside its own try/catch.
    In my case, the ArrayIndexOutOfBoundsException and
    NumberFormatException should be handled by the same way.Why?
    I don't think I have ever seen an ArrayIndexOutOfBoundsException that didn't indicate a bug in the code. Instead of an AIOOBE perhaps there should be an if statement somewhere that prevents it, or the algorithm logic should prevent it automatically.

  • SAVE EXCEPTION CLAUSE

    I'm trying to use the SAVE EXCEPTION clause and load all the records that error into an error table. example of my code is below. This code does not compile, it does not like the way I refrence a column in the collection ie.
    recs.sku(SQL%BULK_EXCEPTIONS(i).ERROR_INDEX)
    is there a better way to do this?
    this is the code:
    TYPE table_object IS TABLE OF tran_data_stage%ROWTYPE;
    recs TABLE_OBJECT;
    l_errors NUMBER(9);
    CURSOR c_tdh_source IS
    SELECT
    sku,
    store,
    wh,
    vdate,
    NULL
    FROM tran_data_history
    WHERE vdate between sysdate -6
    and sysdate;
    BEGIN
    OPEN c_tdh_source;
    LOOP
    BEGIN
    FETCH c_tdh_source BULK COLLECT INTO recs LIMIT 100;
    FORALL i IN recs.FIRST..recs.LAST SAVE EXCEPTIONS
    INSERT INTO tran_data_stage VALUES recs(i);
    EXIT WHEN c_tdh_source%NOTFOUND;
    EXCEPTION
    WHEN OTHERS THEN
    l_errors := SQL%BULK_EXCEPTIONS.COUNT;
    dbms_output.put_line('Number of errors is ' || l_errors);
    FOR i IN 1..l_errors LOOP
    dbms_output.put_line('Error ' || i || ' occurred during '||
    'iteration ' || SQL%BULK_EXCEPTIONS(i).ERROR_INDEX);
    dbms_output.put_line('Oracle error is ' ||
    SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
    INSERT INTO tran_data_stage_errors VALUES
    recs.sku(SQL%BULK_EXCEPTIONS(i).ERROR_INDEX), --here is the error
    5,
    sysdate
    END LOOP;
    END;
    END LOOP;
    COMMIT;
    CLOSE c_tdh_source;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('others error occured' || SQLERRM);
    END;

    Shouldn't that berecs(SQL%BULK_EXCEPTIONS(i).ERROR_INDEX).sku

  • SAVE EXCEPTIONS when fetching from cursors by BULK COLLECT possible?

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    Hello,
    I'm using an Cursor's FETCH by BULK COLLECT INTO mydata...
    Is it possible to SAVE EXCEPTIONS like with FORALL? Or is there any other possibility to handle exceptions during bulk-fetches?
    Regards,
    Martin

    The cursor's SELECT-statement uses TO_DATE(juldat,'J')-function (for converting an julian date value to DATE), but some rows contain an invalid juldat-value (leading to ORA-01854).
    I want to handle this "rows' exceptions" like in FORALL.
    But it could also be any other (non-Oracle/self-made) function within "any" BULK instruction raising (un)wanted exceptions... how can I handle these ones?
    Martin

  • Save Exceptions Memory Issue

    I'm currently using a bulk collect (limit = 100) and a forall insert to load roughly 6.2 million records into a table. If I leave the "Save Exceptions" clause out of the procedure, all 6.2 million records are loaded without an error. THe amount of memory used never exceeds 40MB. If I include the "Save Exceptions" clause and put in the code to record any errors encountered, the memory jumps to over 200MB and the procedure is exceedingly slow. Also, I put a debugging statement after each forall insert to validate that the SQL%BULK_EXCEPTIONS.COUNT = 0 for each iteration. The procedure still completes with no errors, but the memory utilized is still way too high.
    Has anyone run into this before? Is there an environmental setting that needs to be set to use "Save Exceptions" with many rows of data?
    We are currently running 9.2.0.3.0.
    Thanks,
    Scott

    Hello.
    Thank you for your answers. Let me react:
    re 1. - this is the last possible solution which I don't want to take unless it is clear that the upgrade will fix the problem
    re 2. APPEND - just trying to improve the insert, I am not sure if this bit works, however it does not affect the memory problem
    re 3. in accordance with my understanding the LIMIT clause will not help. The amount of data we process in one step is not huge - not more then 10 000 records.
    re 4. we are already doing it, I was just interested whether someone has already seen this problem or not.
    So far I have not found any solutions...

  • Save Exceptions Limitation

    Hello Gurus,
    I have a problem with the Save Exceptions. I am using database 11g.
    When I am doing bulk insert I would like to insert the error records into a new table. But when I am inserting
    the error records I am getting the error "error:- ORA-00984: column not allowed here
    ORA-24381: error(s) in array DML".
    I am putting my code below.
    DECLARE
    CURSOR C_FRT2STORE IS
    SELECT ROWID,
    STORE_CD,
    MNR_CD,
    'FRT',
    DT,
    TO_DATE('31-DEC-2049'),
    FRT_FAC,
    TRUNC(SYSDATE),
    'ADMINUSR'
    FROM FRT2STORE;
    CURSOR C_FRT2STORE_EXC_TAB IS
    SELECT 'Y'
    FROM ALL_TABLES
    WHERE TABLE_NAME = 'FRT2STORE_EXC';
    TYPE STORE$MNR2CST_REC_TYPE IS RECORD
    (C_STORE$MNR2CST_ROWID VARCHAR2(100),
    C_STORE_CD STORE$MNR2CST.STORE_CD%TYPE,
    C_MNR_CD STORE$MNR2CST.MNR_CD%TYPE,
    C_CST_CD STORE$MNR2CST.CST_CD%TYPE,
    C_BEG_DT STORE$MNR2CST.BEG_DT%TYPE,
    C_END_DT STORE$MNR2CST.END_DT%TYPE,
    C_FAC NUMBER(13,3), --STORE$MNR2CST.FAC%TYPE,       
    C_AMT STORE$MNR2CST.AMT%TYPE,
    C_CUBIC_AMT STORE$MNR2CST.CUBIC_AMT%TYPE,
    C_LST_ACTN_DT STORE$MNR2CST.LST_ACTN_DT%TYPE,
    C_EMP_CD STORE$MNR2CST.EMP_CD%TYPE
    TYPE STORE$MNR2CST_TYPE IS TABLE OF STORE$MNR2CST_REC_TYPE
    INDEX BY PLS_INTEGER;
    STORE$MNR2CST_COL STORE$MNR2CST_TYPE;
    V_TOT_REC PLS_INTEGER := 0;
    V_FRT2STORE_EXC_TAB CHAR(1);
    V_TOT_REC_IN_STORE$MNR2CST PLS_INTEGER;
    V_ERR_REC PLS_INTEGER;
    BULK_ERRORS EXCEPTION;
    PRAGMA EXCEPTION_INIT (BULK_ERRORS, -24381);
    BEGIN
    --GETTING DATA FROM FRT2STORE TABLE AND INSERTING INTO THE STORE$MNR2CST TABLE
    SELECT COUNT(1)
    INTO V_TOT_REC_IN_STORE$MNR2CST
    FROM STORE$MNR2CST ;
    IF V_TOT_REC_IN_STORE$MNR2CST = 0 THEN
    OPEN C_FRT2STORE;
    LOOP
    FETCH C_FRT2STORE BULK COLLECT INTO STORE$MNR2CST_COL LIMIT 1000;
    EXIT WHEN STORE$MNR2CST_COL.COUNT = 0;
    V_TOT_REC := STORE$MNR2CST_COL.COUNT;
    IF V_TOT_REC > 0 THEN
    BEGIN
    FORALL I IN STORE$MNR2CST_COL.FIRST..STORE$MNR2CST_COL.LAST SAVE EXCEPTIONS
    INSERT INTO STORE$MNR2CST
    (STORE_CD,
    MNR_CD,
    CST_CD,
    BEG_DT,
    END_DT,
    FAC,
    AMT,
    CUBIC_AMT,
    LST_ACTN_DT,
    EMP_CD
    VALUES
    (STORE$MNR2CST_COL(I).C_STORE_CD,
    STORE$MNR2CST_COL(I).C_MNR_CD,
    STORE$MNR2CST_COL(I).C_CST_CD,
    STORE$MNR2CST_COL(I).C_BEG_DT,
    STORE$MNR2CST_COL(I).C_END_DT,
    STORE$MNR2CST_COL(I).C_FAC,
    STORE$MNR2CST_COL(I).C_AMT,
    STORE$MNR2CST_COL(I).C_CUBIC_AMT,
    STORE$MNR2CST_COL(I).C_LST_ACTN_DT,
    STORE$MNR2CST_COL(I).C_EMP_CD
    COMMIT;
    EXCEPTION WHEN BULK_ERRORS THEN
    OPEN C_FRT2STORE_EXC_TAB;
    FETCH C_FRT2STORE_EXC_TAB INTO V_FRT2STORE_EXC_TAB;
    IF C_FRT2STORE_EXC_TAB%NOTFOUND THEN
    EXECUTE IMMEDIATE ('CREATE TABLE FRT2STORE_EXC AS SELECT * FROM FRT2STORE WHERE 1 = 2');
    END IF;
    CLOSE C_FRT2STORE_EXC_TAB;
    FOR J IN 1..SQL%BULK_EXCEPTIONS.COUNT
    LOOP
    V_ERR_REC := SQL%BULK_EXCEPTIONS(J).ERROR_INDEX;
    EXECUTE IMMEDIATE 'INSERT INTO FRT2STORE_EXC (STORE_CD,MNR_CD,FRT_FAC,DT) VALUES ('
    ||STORE$MNR2CST_COL(V_ERR_REC).C_STORE_CD||','
    ||STORE$MNR2CST_COL(V_ERR_REC).C_MNR_CD||','
    ||STORE$MNR2CST_COL(V_ERR_REC).C_FAC||','
    ||STORE$MNR2CST_COL(V_ERR_REC).C_BEG_DT||')';
    END LOOP;
    COMMIT;
    END;
    STORE$MNR2CST_COL.DELETE;
    END IF;
    END LOOP;
    CLOSE C_FRT2STORE;
    END IF;
    COMMIT;
    EXCEPTION WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('error:- '||SQLERRM);
    END ;
    Could any one tell me how to achive this requirment.
    Thanks,
    Sun

    1. Please format your code using the code tags.
    2. You should never need to code create tables like this "EXECUTE IMMEDIATE ('CREATE TABLE FRT2STORE....". This is often seen when creating temporary tables in non-Oracle database but is a misunderstanding in how to do things in Oracle. You should create them outside of your plsql as permanent objects.
    3. In your example, you should not need dynamic sql like this "EXECUTE IMMEDIATE 'INSERT INTO FRT2STORE_EXC...."
    4. In 10gR2 / 11g, DML Error Logging might be a better solution
    http://www.oracle.com/technology/oramag/oracle/06-mar/o26performance.html

  • FORALL ... SAVE EXCEPTIONS

    Hi folks,
    I want to transfer BULK data from exception_test1 to exception_test2 with FORALL ... SAVE EXCEPTIONS
    procedure execute successfull but no data transfer & no exception raise..
    create or replace
    PROCEDURE forall_exception
    AS
    TYPE t_tab IS TABLE OF exception_test1%ROWTYPE;
    l_tab t_tab := t_tab();
    l_error_count NUMBER;
    ex_dml_errors EXCEPTION;
    PRAGMA EXCEPTION_INIT(ex_dml_errors, -24381); --24381
    -- Perform a bulk operation.
    BEGIN
    FORALL i IN l_tab.first .. l_tab.last SAVE EXCEPTIONS
    INSERT INTO exception_test2
    VALUES l_tab(i);
    EXCEPTION
    WHEN ex_dml_errors THEN
    l_error_count := SQL%BULK_EXCEPTIONS.count;
    DBMS_OUTPUT.put_line('Number of failures: ' || l_error_count);
    FOR i IN 1 .. l_error_count LOOP
    DBMS_OUTPUT.put_line('Error: ' || i ||
    ' Array Index: ' || SQL%BULK_EXCEPTIONS(i).error_index ||
    ' Message: ' || SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
    END LOOP;
    -- END;
    END;

    Hi,
    You have declared the collection. To get the data into the collection, you need to fetch the data into it and then use it later.
    Modify your code to something like:
    create or replace PROCEDURE forall_exception (in_key_val in number)
    AS
    TYPE t_tab IS TABLE OF exception_test1%ROWTYPE;
    l_tab t_tab := t_tab();
    l_error_count NUMBER;
    ex_dml_errors EXCEPTION;
    PRAGMA EXCEPTION_INIT(ex_dml_errors, -24381); --24381
    -- Perform a bulk operation.
    BEGIN
    SELECT * BULK COLLECT INTO l_tab FROM exception_test1 WHERE key_val = in_key_val;
    FORALL i IN l_tab.first .. l_tab.last SAVE EXCEPTIONS
    INSERT INTO exception_test2 VALUES l_tab(i);
    EXCEPTION
    WHEN ex_dml_errors THEN
    l_error_count := SQL%BULK_EXCEPTIONS.count;
    DBMS_OUTPUT.put_line('Number of failures: ' || l_error_count);
    FOR i IN 1 .. l_error_count LOOP
         DBMS_OUTPUT.put_line('Error: ' || i ||
              ' Array Index: ' || SQL%BULK_EXCEPTIONS(i).error_index ||
              ' Message: ' || SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
    END LOOP;
    END;
    /With this, you will have the record fetched into collection l_tab. If any exception occurs, those exceptions will be saved and printed later.

  • Oracle 9i Problem when using multicolumn bulk update with "save exceptions"

    I'm running into a problem with Oracle 9i when running a multicolumn update with "save exceptions". The problem occurs when updating 4 or more fileds. (The data being updated are 40 character text strings)
    I'm updating 1000 records at a time, in bulk.
    The problem goes away when I don't use "save exception" (i.e. catch the exception the normal "pre-Oracle 9i" way) or when I use "save exception" with 3 or fewer fields.
    (I don't get any exceptions when running without the "save exception")
    Thanks

    The problem is an ORA-14403 error detected during bulk updates only when "save exception" is used with more than 3 fields being updated.
    Remove the "save exception" I can update any number of fields.
    or
    Reduce the number of fields being updated to 3 or less and use save exceptions and the 14403 error goes away.
    (I'd like to use "save exception" without having to break the "update" into two separate 3 field updates.)
    Thanks,
    Len

  • Bulk collect exception save

    DROP TABLE TEST1;DROP TABLE TEST2;
    CREATE TABLE TEST1(TNO NUMBER(10), TNAME VARCHAR2(5));
    CREATE TABLE TEST2(TNO NUMBER(10), TNAME VARCHAR2(3), ERR_MSG VARCHAR2(1000));
    INSERT INTO TEST1 VALUES(1,'CAT');
    INSERT INTO TEST1 VALUES(2,'CAT');
    INSERT INTO TEST1 VALUES(3,'CAT1');
    INSERT INTO TEST1 VALUES(4,'CAT1');
    INSERT INTO TEST1 VALUES(5,'CAT1');
    INSERT INTO TEST1 VALUES(6,'CAT');
    INSERT INTO TEST1 VALUES(7,'CAT');
    SELECT * FROM TEST1;
    SELECT * FROM TEST2;
    COMMIT;
    anonymous block:
    DECLARE
       TYPE NumList IS TABLE OF TEST1%ROWTYPE;
       num_tab NumList := NumList();
       CURSOR C1 IS SELECT * FROM TEST1;
       errors  NUMBER;
       dml_errors EXCEPTION;
       PRAGMA exception_init(dml_errors, -24381);
    BEGIN
    FOR I IN C1 LOOP
    num_tab.EXTEND;
    num_tab (num_tab.LAST).TNO := I.TNO;
    num_tab (num_tab.LAST).TNAME := I.TNAME;
    END LOOP;
       FORALL i IN num_tab.FIRST..num_tab.LAST SAVE EXCEPTIONS
          INSERT INTO TEST2(TNO,TNAME) VALUES (num_tab(i).TNO,num_tab(i).TNAME);
    EXCEPTION
      WHEN dml_errors THEN
          errors := SQL%BULK_EXCEPTIONS.COUNT;
       dbms_output.put_line('Number of errors is ' || errors);
       FOR i IN 1..errors LOOP
          dbms_output.put_line('Error ' || i || ' occurred during '||
             'iteration ' || SQL%BULK_EXCEPTIONS(i).ERROR_INDEX);
          dbms_output.put_line('Oracle error is ' ||
             SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
       END LOOP;
    END;
    my need is i want to save the exception record in the same table (test2) with error message in ERR_MSG column
    result is
    SELECT * FROM TEST2;
    TNO                    TNAME ERR_MSG                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
    1                      CAT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    2                      CAT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    6                      CAT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    7                      CAT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    4 rows selected
    required result is
    TNO                    TNAME ERR_MSG                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
    1                      CAT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    2                      CAT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    3                      E     Oracle error is ORA-12899: value too large for column  (actual: , maximum: )
    4                      E     Oracle error is ORA-12899: value too large for column  (actual: , maximum: )
    5                      E     Oracle error is ORA-12899: value too large for column  (actual: , maximum: )
    6                      CAT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    7                      CAT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    7 rows selected

    How about the following (in the exception block)?
    G
    DECLARE
       TYPE NumList IS TABLE OF TEST1%ROWTYPE;
       num_tab NumList := NumList();
       CURSOR C1 IS SELECT * FROM TEST1;
       errors  NUMBER;
       dml_errors EXCEPTION;
       PRAGMA exception_init(dml_errors, -24381);
    BEGIN
    FOR I IN C1 LOOP
    num_tab.EXTEND;
    num_tab (num_tab.LAST).TNO := I.TNO;
    num_tab (num_tab.LAST).TNAME := I.TNAME;
    END LOOP;
       FORALL i IN num_tab.FIRST..num_tab.LAST SAVE EXCEPTIONS
          INSERT INTO TEST2(TNO,TNAME) VALUES (num_tab(i).TNO,num_tab(i).TNAME);
    EXCEPTION
      WHEN dml_errors THEN
         DECLARE
            TYPE NumList2 IS TABLE OF TEST2%ROWTYPE;
            err_tab NumList2 := NumList2();
         BEGIN
            errors := SQL%BULK_EXCEPTIONS.COUNT;
            FOR i IN 1..errors LOOP
               err_tab.EXTEND;
               err_tab(err_tab.LAST).TNO     := num_tab(SQL%BULK_EXCEPTIONS(i).ERROR_INDEX).TNO;
               err_tab(err_tab.LAST).TNAME   := 'E';
               err_tab(err_tab.LAST).ERR_MSG := SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE);
            END LOOP;
            FORALL j IN err_tab.FIRST..err_tab.LAST
               INSERT INTO TEST2 VALUES err_tab(j);
          END; 
    END;
     

  • Error Message in Bulk Exception.

    Hi
    When i use a normal Exception, the SQLERRM gives me the complete error along with the column name.
    Ex :
    ORA-01400: cannot insert NULL into ("BENCHMARK"."T6"."X")
    But
    When i Use Bulk_Exception, SQLERRM does not give me the complete error along with column name.
    Ex:
    ORA-01400: cannot insert NULL into ()
    Is it that Bulk_exception error messages are less informative. These error messages, does not help me in finding out which column is violation the NOT NULL constraint and hence they actually make no sense.
    Is there any way, through which i can get the complete error message as i get in the normal exception.
    I am using 9i version.
    Regards
    Nikhil

    I couldn't find exact solution to your problem, but one idea that came to mind, is resubmit statement with problematic rows (without using bulk processing) and save error messages.
    SQL> declare
      2    bulk_errors exception;
      3    pragma exception_init ( bulk_errors, -24381 );
      4   
      5    j number;   
      6   
      7    type numbers is table of number;
      8    ids numbers;
      9  begin
    10    select case when mod(abs(dbms_random.random),3)=0 then null else 1 end id bulk collect into ids
    11      from dual
    12    connect by level < 10;
    13   
    14    forall i in ids.first .. ids.last save exceptions
    15      insert into test01 values ( ids(i) );
    16    exception when bulk_errors then
    17       for i in 1..sql%bulk_exceptions.count loop
    18         j := sql%bulk_exceptions(i).error_index;
    19         begin
    20            insert into test01 values ( ids(j) );
    21         exception when others then
    22            dbms_output.put_line( 'Row #'||j||'. '||substr(sqlerrm,1,instr(sqlerrm,chr(10))-1) );
    -- substr to get only the first line
    23         end;
    24       end loop;
    25  end;
    26  /
    Row #1. ORA-01400: cannot insert NULL into ("SCOTT"."TEST01"."ID")
    Row #3. ORA-01400: cannot insert NULL into ("SCOTT"."TEST01"."ID")
    Row #6. ORA-01400: cannot insert NULL into ("SCOTT"."TEST01"."ID")
    Row #7. ORA-01400: cannot insert NULL into ("SCOTT"."TEST01"."ID")
    Row #8. ORA-01400: cannot insert NULL into ("SCOTT"."TEST01"."ID")
    Row #9. ORA-01400: cannot insert NULL into ("SCOTT"."TEST01"."ID")

  • One-click 'Save as jpeg' shortcut script please! - saved in the same folder

    Hi, I've been re-directed here because I was told a script could solve my problems - but I have no scripting experience/knowledge/ability! Below is my original problem and post. I got as close as 2 button presses, but I'm after that sweet, sweet single-button, double-my-productivity shortcut! Thanks!
    http://forums.adobe.com/thread/1106992
    I use 'Save as .jpeg' ALL the time (Photoshop CS6, Mac ML), and it really feels like I should just be able to press one button (a shortcut) and the name/quality dialogs don't appear and it just saves a .jpeg into the folder that my original .PSD/file is in.
    So basically:
    - Press one button to save my open .PSD/file as a .jpeg
    - Automatically save it in the same folder as my .PSD
    - Save it as '10' quality in the jpeg settings
    - No dialog boxes, as soon as I press the button, it saves it - if there's already a .jpeg of the same name, it creates a '-1','-2' etc.
    I've tried using 'Actions', but it seems to save it wherever my original Action folder was - it doesn't change to whatever the current folder the .PSD is in...
    Thanks!
    Adam

    File -> Scripts -> Script Events Manager
    Click Enable Events at the top
    Select Save Document from Photoshop Event  drop down
    Select Save Extra JPEG from Script drop down
    Click Add
    Click Done
    EVERY document you save, except JPEG files, will save a jpg file. Saving will be slower.
    You will need to modify line 62 of the Save Extra JPEG.jsx file located here: <YOUR_PHOTOSHOP_INSTALL_LOCATION>\Presets\Scripts\Event Scripts Only
    In order to boost your quality to '10'. Here is the line in question
    jpegOptions.quality = 2; // really low
    Change it to
    jpegOptions.quality = 10; // really high
    You will need to modify the script to get this problem solved as well: it saves it - if there's already a .jpeg of the same name, it creates a '-1','-2' etc.
    You can steal code out of Image Processor that finds a file name that is unique for the folder so you don't get overwrites.
    Are you sure you want that? If you do lots of saves you are going to fill up your disk fast.

  • Invalidate() throws null pointer exception

    Hi experts,
    Any idea why calling invalidate will throw a null pointer exception.
    if (detailNode != null)
         detailNode.invalidate();
    This is the stack trace:
    java.lang.NullPointerException
         at com.sap.tc.webdynpro.progmodel.controller.MessageManager.setAttributeValidbyContext(MessageManager.java:656)
         at com.sap.tc.webdynpro.progmodel.context.NodeElement.clearPendingInput(NodeElement.java:297)
         at com.sap.tc.webdynpro.progmodel.context.NodeElement.exit(NodeElement.java:132)
         at com.sap.tc.webdynpro.progmodel.context.Node$ElementList.exit(Node.java:1859)
         at com.sap.tc.webdynpro.progmodel.context.Node.clearElements(Node.java:1560)
         at com.sap.tc.webdynpro.progmodel.context.Node.onNodeInvalidating(Node.java:1447)
         at com.sap.tc.webdynpro.progmodel.context.Node.fireNodeInvalidating(Node.java:1410)
         at com.sap.tc.webdynpro.progmodel.context.Node.clearElements(Node.java:1556)
         at com.sap.tc.webdynpro.progmodel.context.Node.onNodeInvalidating(Node.java:1447)
         at com.sap.tc.webdynpro.progmodel.context.Node.fireNodeInvalidating(Node.java:1410)
         at com.sap.tc.webdynpro.progmodel.context.Node.clearElements(Node.java:1556)
         at com.sap.tc.webdynpro.progmodel.context.Node.invalidate(Node.java:583)
         at com.sap.tc.webdynpro.progmodel.context.Node.invalidate(Node.java:580)
         at com.diagonal.mmm.component.MenuDetailsController.save(MenuDetailsController.java:281)
         at com.diagonal.mmm.component.wdp.InternalMenuDetailsController.save(InternalMenuDetailsController.java:1250)
         at com.diagonal.mmm.view.MenuDetailsView.onActionSave(MenuDetailsView.java:965)
         at com.diagonal.mmm.view.wdp.InternalMenuDetailsView.wdInvokeEventHandler(InternalMenuDetailsView.java:999)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
         at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:132)
         at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
         at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:313)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:713)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:666)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:250)
         at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(AccessController.java:215)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)

    Hello,
    we are having the save Exception.
    We are not working with modelNodes  only with valueNodes.
    We can reproduce the Exception, when doing the same as Daniel
    Daniel  Lam wrote:
    I get the exception after doing the following:
    1. The data from detailNode are displayed in a table.
    2. I changed the value of one the field to an invalid text and attempt to save the application. I got a validation error.
    3. I changed back to the original value and save again and i got the exception.
    How did you solve it?
    What are we doing wrong?`
    Can somebody help me please?

  • Fill and save form in Acrobat Reader + checkbox problem

    I use Acrobat Pro X to create fillable forms and then save the file as Reader Extended PDF - Enable Additional Features, and when I want to open it and fill it in in Acrobat Reader, I get a pop-up saying I can only save it as a blank document.
    Another issue I'm having is that when I fill it in Preview and save it, everything saves except the checkboxes, they are always blank.
    Could this be because I'm using Mac OS X Lion?

    I'm sure I open the one that I save as enabled version but it does sound like the file is just being saved as a regular PDF. Here is the screenshot below of the security settings, I'm not sure exactly what the enabled version is supposed to show.
    And here is the message I'm getting:

  • FORALL Exception handling problem

    Hi All,
    I have one doubt in forall exception handling. I have gone through the SAVE EXCEPTION for bulk collect but i have one more query
    BEGIN
    FORALL j IN l_tab.first .. l_tab.last
    INSERT INTO exception_test
    VALUES (l_tab(i));
    EXCEPTION
    END;
    My requirement is when an exception occurs, i ant to print the values of the collection.
    e.g. say l_tab (j).emp_number, l_tab (j).emp_id.
    How is that possible?
    Thanks
    Samarth
    Edited by: 950810 on Mar 12, 2013 7:28 PM

    >
    I have one doubt in forall exception handling. I have gone through the SAVE EXCEPTION for bulk collect but i have one more query
    BEGIN
    FORALL j IN l_tab.first .. l_tab.last
    INSERT INTO exception_test
    VALUES (l_tab(i));
    EXCEPTION
    END;
    My requirement is when an exception occurs, i ant to print the values of the collection.
    e.g. say l_tab (j).emp_number, l_tab (j).emp_id.
    How is that possible?
    >
    Post the code you are using. You didn't post the FORALL that is using SAVE EXCEPTIONS.
    The SQL%BULK_EXCEPTIONS associative array that you get has the INDEX of the collection element that caused the exception.
    So you need to use those indexes to index into the original collection to get whatever values are in it.
    One index from the exception array is:
    SQL%BULK_EXCEPTIONS(i).error_index So if your original collection is named 'myCollection' you would reference that collection value as:
    myCollection(SQL%BULK_EXCEPTIONS(i).error_index); See 'Handling FORALL Exceptions (%BULK_EXCEPTIONS Attribute)' in the PL/SQL Language doc
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/tuning.htm#i49099
    >
    All exceptions raised during the execution are saved in the cursor attribute %BULK_EXCEPTIONS, which stores a collection of records. Each record has two fields:
    %BULK_EXCEPTIONS(i).ERROR_INDEX holds the iteration of the FORALL statement during which the exception was raised.
    %BULK_EXCEPTIONS(i).ERROR_CODE holds the corresponding Oracle Database error code.
    The values stored by %BULK_EXCEPTIONS always refer to the most recently executed FORALL statement. The number of exceptions is saved in %BULK_EXCEPTIONS.COUNT. Its subscripts range from 1 to COUNT.
    The individual error messages, or any substitution arguments, are not saved, but the error message text can looked up using ERROR_CODE with SQLERRM as shown in Example 12-9.
    You might need to work backward to determine which collection element was used in the iteration that caused an exception. For example, if you use the INDICES OF clause to process a sparse collection, you must step through the elements one by one to find the one corresponding to %BULK_EXCEPTIONS(i).ERROR_INDEX. If you use the VALUES OF clause to process a subset of elements, you must find the element in the index collection whose subscript matches %BULK_EXCEPTIONS(i).ERROR_INDEX, and then use that element's value as the subscript to find the erroneous element in the original collection.

  • How can i handle exceptions in bulck collect?

    Hi All,
    in case of any exception will raise i just print the emp_no prefix with sqlerrm.but i got sqlerrm only ,now the emp_no is blank.how can i print my emp_no.
    SET serveroutput ON;
    DECLARE
    TYPE employee_tab IS TABLE OF emp_ins%ROWTYPE
    INDEX BY BINARY_INTEGER;
    CURSOR c1 IS SELECT * FROM emp_ins ORDER BY emp_no;
    Employee_data      employee_tab;
    lv_n_emp_no NUMBER;
    lv_n_count NUMBER:=1;
    BEGIN
         IF c1%isopen THEN
         CLOSE C1;
         END IF;     
         OPEN C1;
         FETCH C1 BULK COLLECT INTO Employee_data;
         CLOSE C1;     
         FORALL i IN Employee_data.FIRST..Employee_data.LAST     
         INSERT INTO emp_test VALUES Employee_data(i);          
         lv_n_emp_no:=Employee_data(lv_n_count).emp_no;
    lv_n_count:= NVL (lv_n_count, 1) + 1;
         COMMIT;     
         Employee_data.DELETE;     
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(lv_n_emp_no||','||SQLERRM);
    END;
    Regards
    Gopinath M

    SQL> create table emp_test as select * from emp where 1=2
      2  /
    Tabel is aangemaakt.
    SQL> alter table emp_test add constraint emp_ck check (sal > 1500)
      2  /
    Tabel is gewijzigd.
    SQL> declare
      2    type t_employee_tab is table of emp%rowtype index by binary_integer;
      3    r_employee_data t_employee_tab;
      4    e_bulk_errors exception;
      5    pragma exception_init ( e_bulk_errors, -24381 );
      6  begin
      7    select *
      8      bulk collect into r_employee_data
      9      from emp
    10     order by empno
    11    ;
    12    forall i in r_employee_data.first..r_employee_data.last save exceptions
    13      insert into emp_test values r_employee_data(i);
    14  exception
    15  when e_bulk_errors then
    16    for j in 1..sql%bulk_exceptions.count
    17    loop
    18      dbms_output.put_line
    19      ( r_employee_data(sql%bulk_exceptions(j).error_index).empno
    20        || ', ' || r_employee_data(sql%bulk_exceptions(j).error_index).ename
    21        || ', (sal=' || r_employee_data(sql%bulk_exceptions(j).error_index).sal
    22        || ') :' || sqlerrm(-sql%bulk_exceptions(j).error_code)
    23      );
    24    end loop;
    25  end;
    26  /
    7369, SMITH, (sal=800) :ORA-02290: check constraint (.) violated
    7521, WARD, (sal=1250) :ORA-02290: check constraint (.) violated
    7654, MARTIN, (sal=1250) :ORA-02290: check constraint (.) violated
    7844, TURNER, (sal=1500) :ORA-02290: check constraint (.) violated
    7876, ADAMS, (sal=1100) :ORA-02290: check constraint (.) violated
    7900, JAMES, (sal=950) :ORA-02290: check constraint (.) violated
    7934, MILLER, (sal=1300) :ORA-02290: check constraint (.) violated
    PL/SQL-procedure is geslaagd.
    SQL> select * from emp_test
      2  /
         EMPNO ENAME      JOB              MGR HIREDATE                   SAL       COMM     DEPTNO
          7499 ALLEN      SALESMAN        7698 20-02-1981 00:00:00       1600        300         30
          7566 JONES      MANAGER         7839 02-04-1981 00:00:00       2975                    20
          7698 BLAKE      MANAGER         7839 01-05-1981 00:00:00       2850                    30
          7782 CLARK      MANAGER         7839 09-06-1981 00:00:00       2450                    10
          7788 SCOTT      ANALYST         7566 09-12-1982 00:00:00       3000                    20
          7839 KING       PRESIDENT            17-11-1981 00:00:00       5000                    10
          7902 FORD       ANALYST         7566 03-12-1981 00:00:00       3000                    20
    7 rijen zijn geselecteerd.Regards,
    Rob.

Maybe you are looking for