ORA-10632 - Invalid rowid

Hi All,
I have scheduled a job to execute the following code to perform row movement and shrink space weekly. However, I encounter ORA-10632 while running this job. I have read the online solution to resolve this issues is to re-issue the command.
Is it because there are too many tables executing enable row movement and shrink space which causes ORA-10632 error?
Please advise.
Thank you.
BEGIN
      OPEN cur FOR
         SELECT TABLE_NAME
          FROM TABLE_MAINTENANCE;
      LOOP
        FETCH cur
            INTO p_tablename;
        EXIT WHEN cur%NOTFOUND;
        EXECUTE IMMEDIATE 'ALTER TABLE ' || p_tablename || ' ENABLE ROW MOVEMENT';
        EXECUTE IMMEDIATE 'ALTER TABLE ' || p_tablename || ' SHRINK SPACE';
      END LOOP;
ENDEdited by: liangtehz on Jun 5, 2009 7:02 PM

Hello,
Cause :      Segment Highwatermark was overwritten due to shrink and space reused
Action :      Reissue this command.
Therefore, perhaps:
BEGIN
     EXECUTE IMMEDIATE 'ALTER TABLE ' || p_tablename || ' ENABLE ROW MOVEMENT';
        EXECUTE IMMEDIATE 'ALTER TABLE ' || p_tablename || ' SHRINK SPACE';
  EXCEPTION
    WHEN OTHERS THEN
       EXECUTE IMMEDIATE 'ALTER TABLE ' || p_tablename || ' SHRINK SPACE';
END;
...

Similar Messages

  • Help to Identify the peace of code Causing - ORA-01410: invalid ROWID

    Hi I have Plsql Block that runs monthly and process 10 million records and every once in a while it fails with the ORA-01410: invalid ROWID Error ,last month it failed two times with same error ,if any one could point me what is wrong this code ,i will work on it to fix. if you see the code we have exceptio n block at the end of the code ,we have procedure that inserts a record into log table ,so both the failures had inserted a record into the table that means it failed before it entered into for loop.
    my question is can Fech statement cause invalid rowid.
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    DECLARE
      cFetchLimit CONSTANT NUMBER := 100000; 
      nRunningTotal NUMBER := 0;
      CURSOR curRawData IS
          SELECT rawdata.*, SYS_GUID() combinedprofitdataid,
               NVL((SELECT 'Y'    
                    FROM   SNAP_CDS_HR_NONSENSITIVE_DATA
                    WHERE  emplid = LPAD(rawdata.fk_westprireltnshpmanagerempid,11,'0')),'N') hrempexists,
               NVL((SELECT MAX('Y')      
                    FROM   SNAP_MAX_Entity
                    WHERE  AU     = DECODE(LENGTH(REPLACE(TRANSLATE(rawdata.fk_west_bookingau, '0123456789' ,'**********'), '*', NULL)), NULL, rawdata.fk_west_bookingau, NULL) 
                    ),'N') bookingauexists,               
               NVL((SELECT  MAX('Y')
                    FROM   SNAP_MAX_Entity
                    WHERE  AU     = DECODE(LENGTH(REPLACE(TRANSLATE(rawdata.fk_westprireltnshpmanagerempau, '0123456789' ,'**********'), '*', NULL)), NULL, rawdata.fk_westprireltnshpmanagerempau, NULL)
                    ),'N') prirelmanempauexists,
               NVL((SELECT  MAX('Y')          
                    FROM   SNAP_MAX_ProductGroup
                    WHERE  ProductGroupId = DECODE(LENGTH(REPLACE(TRANSLATE(rawdata.fk_west_productgroupid, '0123456789' ,'**********'), '*', NULL)), NULL, rawdata.fk_west_productgroupid, NULL)
                    ),'N') productgroupexists,
               NVL((SELECT  MAX('Y')          
                    FROM   SNAP_MAX_Product
                    WHERE  ProductId = rawdata.fk_west_productid
                    ),'N') productidexists,
               NVL((SELECT  MAX('Y')
                    FROM   SNAP_MAX_SubProduct
                    WHERE  SubProductId = rawdata.fk_west_subproductid
                    ),'N') subproductidexists,
               (SELECT  e.GL_ENTITY       
                        FROM SNAP_CDS_HR_NONSENSITIVE_DATA e
                       WHERE e.emplid = LPAD(rawdata.fk_westprireltnshpmanagerempid,11,'0')
                         AND e.AU = rawdata.FK_WESTPRIRELTNSHPMANAGEREMPAU ) entity_fk_westprirelmanempau
        FROM   T_rawdata rawdata
        WHERE rawdata.dda_flag = 'N';
      TYPE RawData_aat IS TABLE OF curRawData%ROWTYPE INDEX BY PLS_INTEGER;
      l_RawData RawData_aat;   
      TYPE CombinedProfitData_aat IS TABLE OF T_WIS_CDS_COMBINEDPROFITDATA%ROWTYPE INDEX BY PLS_INTEGER;
      l_CombinedP CombinedProfitData_aat;
      cpdIdx NUMBER := 0;
      vcHREmpExists          VARCHAR2(1) := 'N';
      vcBookingAuExists      VARCHAR2(1) := 'N';
      vcPriRelManEmpAuExists VARCHAR2(1) := 'N';
      vcProductGroupExists   VARCHAR2(1) := 'N';
      vcProductIDExists      VARCHAR2(1) := 'N';
      vcSubProductIDExists   VARCHAR2(1) := 'N';
      vcBEIDExists           VARCHAR2(1) := 'N';
      l_raw_accountnum           t_wis_cds_h_act_rawdata.account%TYPE                   := NULL;
      l_raw_bank_id              t_wis_cds_h_act_rawdata.account%TYPE                   := NULL;
      l_west_sourcesystem        t_wis_cds_h_act_rawdata.sourcesystem%TYPE              := NULL;
      l_fnd_combinedprofitdataid T_WIS_CDS_COMBINEDPROFITDATA.combinedprofitdataid%TYPE := NULL;
      FUNCTION BEIDExists(p_west_be_id VARCHAR2) RETURN VARCHAR2 IS
        CURSOR curBEIDData IS
          SELECT 'Y'
          FROM   SNAP_STOBEX_BUSINESS_ENTITY
          WHERE  be_id  = p_west_be_id;
      BEGIN     
        FOR recBEIDData IN curBEIDData LOOP
          RETURN 'Y';
        END LOOP;
        RETURN 'N';   
      EXCEPTION
      WHEN OTHERS THEN
         P_WIS_CDS.LOG('exists', SQLCODE, SQLERRM);
        RETURN 'N'; 
      END BEIDExists;  
    BEGIN
      OPEN curRawData;
      LOOP
        FETCH curRawData BULK COLLECT INTO l_RawData LIMIT cFetchLimit;
        EXIT WHEN l_RawData.COUNT = 0;       
        l_CombinedP.DELETE;
        cpdIdx := 0;
        nRunningTotal := nRunningTotal + l_RawData.COUNT;
        P_WIS_CDS.info('Merge_cp','0', 'Processing '||nRunningTotal||' rows @ '||SYSDATE);
        FOR i IN l_RawData.FIRST..l_RawData.LAST LOOP
            cpdIdx := (cpdIdx+1);       
            vcHREmpExists          := 'N';
            vcBookingAuExists      := 'N';
            vcPriRelManEmpAuExists := 'N';
            vcProductGroupExists   := 'N';
            vcProductIDExists      := 'N';
            vcSubProductIDExists   := 'N';
            vcBEIDExists           := 'N';
            l_CombinedP(cpdIdx).exportsource      := l_RawData(i).exportsource;
            l_CombinedP(cpdIdx).exportsourcetype  := l_RawData(i).exportsourcetype;
            l_CombinedP(cpdIdx).fk_exportsourceid := l_RawData(i).exportsourceid;
            IF l_RawData(i).fk_westprireltnshpmanagerempid IS NOT NULL THEN
              l_CombinedP(cpdIdx).fk_westprireltnshpmanagerempid :=
                                          LPAD(l_RawData(i).fk_westprireltnshpmanagerempid, 11, '0');       
            ELSE
              l_CombinedP(cpdIdx).fk_westprireltnshpmanagerempid := NULL;
            END IF;
            l_CombinedP(cpdIdx).fk_west_productgroupid :=
                                                l_RawData(i).fk_west_productgroupid;  
            l_CombinedP(cpdIdx).fk_west_productid      :=
                                                     l_RawData(i).fk_west_productid;
            l_CombinedP(cpdIdx).fk_west_subproductid   :=
                                                  l_RawData(i).fk_west_subproductid;
            l_CombinedP(cpdIdx).fk_west_bookingau := NULL;
            IF l_RawData(i).fk_westprireltnshpmanagerempau IS NOT NULL OR l_RawData(i).fk_westprireltnshpmanagerempau <> '0' THEN
         l_CombinedP(cpdIdx).fk_westprireltnshpmanagerempau :=
                                     lpad(l_RawData(i).fk_westprireltnshpmanagerempau,7,'0');   ---->751 task
         ELSE
         l_CombinedP(cpdIdx).fk_westprireltnshpmanagerempau := NULL;
         END IF;         
            l_CombinedP(cpdIdx).combinedprofitdataid         := l_RawData(i).combinedprofitdataid; ---SYS_GUID();
            l_CombinedP(cpdIdx).exportsource                 := l_RawData(i).exportsource;
            l_CombinedP(cpdIdx).exportsourcetype             := l_RawData(i).exportsourcetype;
            l_CombinedP(cpdIdx).fk_exportsourceid            := l_RawData(i).exportsourceid;
            l_CombinedP(cpdIdx).endofmonthdate               := l_RawData(i).endofmonthdate;
            l_CombinedP(cpdIdx).account                      := l_RawData(i).account;
            l_CombinedP(cpdIdx).westaccount                  := l_RawData(i).westaccount;
         IF l_RawData(i).westaccount IS NOT NULL
         THEN
              l_CombinedP(cpdIdx).iseastaccountconvertedtowest := 'Y';
         END IF;
                BEGIN
                  SELECT customer.WEST_BE_ID,
                         linkage.parent_id,
                         linkage.top_parent_id
                  INTO   l_CombinedP(cpdIdx).fk_west_be_id,
                         l_CombinedP(cpdIdx).fk_west_ber_id,
                         l_CombinedP(cpdIdx).fk_west_hlber_id
                  FROM   SNAP_STOBEX_BE_BER_LINKAGE linkage,
                         T_EastToWest customer
                  WHERE  customer.east_customerid = l_RawData(i).fk_customerid
                  AND    customer.east_accountid  = NVL(l_RawData(i).westaccount,l_RawData(i).account)
                  AND    linkage.entity_id(+)     = customer.west_be_id
                  AND    linkage.entity_type(+)   = 'BE'
                  AND    ROWNUM                   = 1;
                EXCEPTION
                WHEN NO_DATA_FOUND THEN
                  BEGIN
                    SELECT customer.WEST_BE_ID,
                           linkage.parent_id,
                           linkage.top_parent_id
                    INTO   l_CombinedP(cpdIdx).fk_west_be_id,
                           l_CombinedP(cpdIdx).fk_west_ber_id,
                           l_CombinedP(cpdIdx).fk_west_hlber_id
                    FROM   SNAP_STOBEX_BE_BER_LINKAGE linkage,
                           T_EastToWest customer
                    WHERE  customer.east_customerid = l_RawData(i).fk_customerid
                    AND    customer.east_accountid  = l_RawData(i).account
                    AND    linkage.entity_id(+)     = customer.west_be_id
                    AND    linkage.entity_type(+)   = 'BE'
                    AND    ROWNUM                   = 1;
                  EXCEPTION            
                    WHEN OTHERS THEN                           
                     l_CombinedP(cpdIdx).fk_west_be_id    := NULL;
                     l_CombinedP(cpdIdx).fk_west_ber_id   := NULL;
                     l_CombinedP(cpdIdx).fk_west_hlber_id := NULL;
                  END;
                WHEN OTHERS THEN                           
                  l_CombinedP(cpdIdx).fk_west_be_id    := NULL;
                  l_CombinedP(cpdIdx).fk_west_ber_id   := NULL;
                  l_CombinedP(cpdIdx).fk_west_hlber_id := NULL;
                END;
            l_fnd_combinedprofitdataid := NULL;
            BEGIN
                SELECT  COMBINEDPROFITDATAID
                  INTO l_fnd_combinedprofitdataid
                  FROM T_WIS_CDS_COMBINEDPROFITDATA cpd
                 WHERE cpd.fk_west_be_id                   = l_CombinedP(cpdIdx).fk_west_be_id
                   AND cpd.fk_west_productgroupid          = l_CombinedP(cpdIdx).fk_west_productgroupid
                   AND cpd.fk_west_productid               = l_CombinedP(cpdIdx).fk_west_productid
                   AND cpd.fk_west_subproductid            = l_CombinedP(cpdIdx).fk_west_subproductid
                   AND extract(month from cpd.endofmonthdate)   = extract(month from l_CombinedP(cpdIdx).endofmonthdate)
                   AND extract(year from cpd.endofmonthdate) = extract(year from l_CombinedP(cpdIdx).endofmonthdate) 
                   AND cpd.revenue BETWEEN l_CombinedP(cpdIdx).revenue - 10.00 AND l_CombinedP(cpdIdx).revenue + 10.00               
                   AND cpd.exportsource <> 'CP'
                   AND ROWNUM = 1;
            EXCEPTION
              WHEN NO_DATA_FOUND THEN
                l_fnd_combinedprofitdataid := NULL;
              WHEN OTHERS THEN
                l_fnd_combinedprofitdataid := NULL;
            END;
            IF l_fnd_combinedprofitdataid IS NOT NULL THEN
              l_CombinedP(cpdIdx).isduplicate       := 'Y';
              l_CombinedP(cpdIdx).fk_duplicatecpdid := l_fnd_combinedprofitdataid;         
            ELSE
              l_CombinedP(cpdIdx).isduplicate       := 'N';
              l_CombinedP(cpdIdx).fk_duplicatecpdid := NULL;
            END IF;
            l_CombinedP(cpdIdx).iserror      := 'N';
            l_CombinedP(cpdIdx).errormessage := NULL;   
         IF l_CombinedP(cpdIdx).FK_WESTPRIRELTNSHPMANAGEREMPAU IS NULL AND l_CombinedP(cpdIdx).ENTITY_FK_WESTPRIRELMANEMPAU IS NOT NULL THEN
              l_CombinedP(cpdIdx).iserror      := 'Y';
              IF (LENGTH(NVL(l_CombinedP(cpdIdx).errormessage,0))+LENGTH('FK_WESTPRIRELTNSHPMANAGEREMPAU is NULL but Entity value exists. ')) < 250 THEN
                l_CombinedP(cpdIdx).errormessage := l_CombinedP(cpdIdx).errormessage||'FK_WESTPRIRELTNSHPMANAGEREMPAU is NULL but Entity value exists. ';
              END IF;
            END IF;
            IF l_CombinedP(cpdIdx).fk_westprireltnshpmanagerempid IS NULL AND
              l_RawData(i).primaryrelationshipmanagerid IS NOT NULL THEN
              l_CombinedP(cpdIdx).iserror      := 'Y';
              IF (LENGTH(NVL(l_CombinedP(cpdIdx).errormessage,0))+LENGTH('Missing CP RM/EMP ID translation. ')) < 250 THEN
                l_CombinedP(cpdIdx).errormessage := l_CombinedP(cpdIdx).errormessage||'Missing CP RM/EMP ID translation. ';
              END IF;                             
            ELSE               
              vcHREmpExists := l_RawData(i).HREmpExists;
              IF vcHREmpExists <> 'Y' THEN
                l_CombinedP(cpdIdx).iserror      := 'Y';
                IF (LENGTH(NVL(l_CombinedP(cpdIdx).errormessage,0))+LENGTH('Invalid CP RM/Emp ID translation. ')) < 250 THEN
                  l_CombinedP(cpdIdx).errormessage := l_CombinedP(cpdIdx).errormessage||'Invalid CP RM/Emp ID translation. ';
                END IF;
              END IF;
            END IF;
            IF l_CombinedP(cpdIdx).fk_westprireltnshpmanagerempau IS NULL AND
              l_RawData(i).primaryrelationshipmanagerau IS NOT NULL THEN
              l_CombinedP(cpdIdx).iserror      := 'Y';
              IF (LENGTH(NVL(l_CombinedP(cpdIdx).errormessage,0))+LENGTH('Missing CP RM/EMP AU reference. ')) < 250 THEN
                l_CombinedP(cpdIdx).errormessage := l_CombinedP(cpdIdx).errormessage||'Missing CP RM/EMP AU reference. ';
              END IF;       
            END IF;
            vcPriRelManEmpAuExists := l_RawData(i).PriRelManEmpAuExists;      
            IF vcBookingAuExists <> 'Y' THEN
              l_CombinedP(cpdIdx).iserror      := 'Y';
              IF (LENGTH(NVL(l_CombinedP(cpdIdx).errormessage,0))+LENGTH('Invalid CP RM/Emp AU translation. ')) < 250 THEN
                l_CombinedP(cpdIdx).errormessage := l_CombinedP(cpdIdx).errormessage||'Invalid CP RM/Emp AU translation. ';
              END IF;
            END IF;
            IF l_CombinedP(cpdIdx).fk_west_productgroupid IS NULL THEN
              l_CombinedP(cpdIdx).iserror      := 'Y';
              IF (LENGTH(NVL(l_CombinedP(cpdIdx).errormessage,0))+LENGTH('Missing CP Product Group translation. ')) < 250 THEN
                l_CombinedP(cpdIdx).errormessage := l_CombinedP(cpdIdx).errormessage||'Missing CP Product Group translation. ';
              END IF;
            ELSE
              vcProductGroupExists := l_RawData(i).ProductGroupExists;      
              IF vcProductGroupExists <> 'Y' THEN
                l_CombinedP(cpdIdx).iserror      := 'Y';
                IF (LENGTH(NVL(l_CombinedP(cpdIdx).errormessage,0))+LENGTH('Invalid CP Product Group translation. ')) < 250 THEN
                  l_CombinedP(cpdIdx).errormessage := l_CombinedP(cpdIdx).errormessage||'Invalid CP Product Group translation. ';
                END IF;
              END IF;
            END IF;
            IF l_CombinedP(cpdIdx).fk_west_productid IS NOT NULL THEN
              vcProductIdExists := l_RawData(i).ProductIdExists;      
              IF vcProductGroupExists <> 'Y' THEN
                l_CombinedP(cpdIdx).iserror      := 'Y';
                IF (LENGTH(NVL(l_CombinedP(cpdIdx).errormessage,0))+LENGTH('Invalid CP Product translation. ')) < 250 THEN
                  l_CombinedP(cpdIdx).errormessage := l_CombinedP(cpdIdx).errormessage||'Invalid CP Product translation. ';
                END IF;
              END IF;
            END IF;
            IF l_CombinedP(cpdIdx).fk_west_subproductid IS NOT NULL THEN
              vcSubProductIdExists := l_RawData(i).SubProductIdExists;      
              IF vcSubProductIdExists <> 'Y' THEN
                l_CombinedP(cpdIdx).iserror      := 'Y';
                IF (LENGTH(NVL(l_CombinedP(cpdIdx).errormessage,0))+LENGTH('Invalid CP Sub Product translation. ')) < 250 THEN
                  l_CombinedP(cpdIdx).errormessage := l_CombinedP(cpdIdx).errormessage||'Invalid CP Sub Product translation. ';
                END IF;
              END IF;
            END IF;
            IF l_CombinedP(cpdIdx).fk_west_be_id IS NULL THEN
              l_CombinedP(cpdIdx).iserror      := 'Y';
              IF (LENGTH(NVL(l_CombinedP(cpdIdx).errormessage,0))+LENGTH('Missing CP BE ID translation. ')) < 250 THEN
                l_CombinedP(cpdIdx).errormessage := l_CombinedP(cpdIdx).errormessage||'Missing CP BE ID translation. ';
              END IF;
            ELSE
              vcBEIDExists := BEIDExists(l_CombinedP(cpdIdx).fk_west_be_id);      
              IF vcBEIDExists <> 'Y' THEN
                l_CombinedP(cpdIdx).iserror      := 'Y';
                IF (LENGTH(NVL(l_CombinedP(cpdIdx).errormessage,0))+LENGTH('Invalid CP BE ID translation. ')) < 250 THEN
                  l_CombinedP(cpdIdx).errormessage := l_CombinedP(cpdIdx).errormessage||'Invalid CP BE ID translation. ';
                END IF;
              END IF;
            END IF;
        END LOOP;
        FORALL i in l_CombinedP.FIRST..l_CombinedP.LAST
          INSERT INTO T_WIS_CDS_COMBINEDPROFITDATA 
          VALUES l_CombinedP(i);
       COMMIT;  
      END LOOP;
      CLOSE curRawData;
    COMMIT; 
    EXCEPTION
    WHEN OTHERS THEN
      IF curRawData%ISOPEN THEN
        CLOSE curRawData;
      END IF;
       P_WIS_CDS.LOG('Error', SQLCODE, SQLERRM);
    END;
    /Thank you

    I just looked at all the ddls' i have the following syntax for all MV's
    CREATE MATERIALIZED VIEW WIS.SNAP_MAX_ENTITY
    TABLESPACE WIS_CDS_DATA01
    PCTUSED    0
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          80K
                MINEXTENTS       1
                MAXEXTENTS       UNLIMITED
                PCTINCREASE      0
                BUFFER_POOL      DEFAULT
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    BUILD IMMEDIATE
    USING INDEX
                TABLESPACE WIS_DATA01
                PCTFREE    10
                INITRANS   2
                MAXTRANS   255
                STORAGE    (
                            INITIAL          80K
                            NEXT             80K
                            MINEXTENTS       1
                            MAXEXTENTS       UNLIMITED
                            PCTINCREASE      0
                            FREELISTS        1
                            FREELIST GROUPS  1
                            BUFFER_POOL      DEFAULT
    REFRESH FORCE ON DEMAND
    WITH PRIMARY KEYEdited by: vijayp on Aug 7, 2012 6:44 PM
    Edited by: vijayp on Aug 7, 2012 7:02 PM

  • Local Domain Index  query fails with ora-01410: invalid rowid

    Hello!
    I have a task to implement partitioned domain index for range partitioned table.
    As I understood from reference http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28425/dom_idx.htm
    the main difference is to provide support for partitioning operations by
    implementing corresponding ODCI interface functions.
    For the first I decided to create something simple to not spend time on system partitioned
    index storage table. My problem is that domain index works correctly when it's created without
    support for partitioning and produces "*ORA-01410: INVALID ROWID*" when it's created
    with LOCAL option.
    Test query:
    SELECT /* +index(from_sample_index) */ * FROM index_in_partitioned_tbl WHERE position_between(card_no)  < 50 ORDER BY card_no DESC;
    Index creared in this way returns 3 rows:
    CREATE INDEX from_sample_index ON index_in_partitioned_tbl (card_no) INDEXTYPE IS position_indextype;
    When index has been creared with LOCAL option I got "ORA-01410: INVALID ROWID" :
    CREATE INDEX from_sample_index ON index_in_partitioned_tbl (card_no) INDEXTYPE IS position_indextype LOCAL;
    I don't post implementation's source code to reduce amount of text in post. It works for global index.
    If I copy rowid from index storage table and then put it into something like
    SELECT card_no FROM index_in_partitioned_tbl WHERE rowid = 'AAAXHGAAEAAAFERAAh';
    then it will be executed successfully without any errors.
    I suppose the error could be somehow linked with "alter index" calls that Oracle makes when local domain index is created.
    The calls are made with option "AlterIndexRebuild" - possibly they mark index as invalid (though it's shown as valid in SQL Developer)

    Solved :)
    when index is LOCAL calls for ODCIINDEXSTART - ODCIINDEXFETCH - ODCIINDEXCLOSE are executed for each partition of base table.
    In my case ODCIINDEXFETCH returns row_id's regardless of partition that are currently scanned for values. So first call returned rowid values for all partitions not only for the first partition and validation failed with "ora-01410: invalid rowid"

  • Raise Form_Trigger_Failure on When-Button-Pressed  ORA-01410 Invalid RowID

    Hello to all...
    I have an error whit Raise Form_Trigger_Failure on trigger When-Button-Pressed.
    I guess the error is when does the Raise Form_Trigger_Failure
    When validate something, this validation ask me if i want to continue.
    When i answer NO, give me this error: ORA-01410 Invalid RowID
    If i answer YES, the process continue and in an unexpected moment, give that error too
    Why give me that error?
    How can i resolve this error...help me
    thanks...
    Part of Code
    FOR i IN 1..TItemsAsi1.LAST LOOP
    IF TItemsAsi1(i).c_error IS NOT NULL THEN
    l_error := l_error + 1;
    IF TItemsAsi1(i).c_error = 'ND' THEN
    IF NOT Fpa_mensaje.disp_consulta_sino('Atención','No hay datos suficientes para generar Asiento de cierre relacionado a Reconocimiento de los recursos del ejercicio') THEN           
    RAISE FORM_TRIGGER_FAILURE;
    END IF ;     ELSIF TItemsAsi1(i).c_error = 'AD' THEN
    IF NOT Fpa_mensaje.disp_consulta_sino('Atención','Hay cuentas Acreedoras con saldo Deudor CUENTA: '||TItemsAsi1(i).c_cuenta||'. ¿Desea continuar con el cierre? ') THEN           
    RAISE FORM_TRIGGER_FAILURE;
    END IF ;     ELSIF TItemsAsi1(i).c_error = 'DA' THEN
    IF NOT Fpa_mensaje.disp_consulta_sino('Atención','Hay cuentas Deudoras con saldo Acreedor CUENTA:'||TItemsAsi1(i).c_cuenta||'. ¿Desea continuar con el cierre? ') THEN           
    RAISE FORM_TRIGGER_FAILURE;
    END IF ;     END IF;END IF;END LOOP;

    delete from <table> where rowid like '<block id>%'Arrgh. To be honest, this is the worst sql-statement i have seen this year. i hope the statement will raise an error on execution, but even if it would get executed, what should be the reason for something like this? Delete anything which is stored in a specific block, regardless of the meaning ?

  • ORA-01410: invalid ROWID, when procedure is executed

    Hi,
    I am using Oracle 10g 10.2.0.3 on linux 64 bit
    I am getting following error
    ORA-12012: error on auto execute of job 17069
    ORA-01410: invalid ROWID
    ORA-06512: at "t1.DR1", line 12
    ORA-06512: at line 1
    t1 is the schema and DR1 is the procedure run every hour
    Error in Alert log showing thirce time.
    Following is the content of procedure
    create or replace procedure t1.dr1
    is
    CURSOR CS1
    IS
    select * FROM t1.V_TL_DR1;
    begin
    FOR CURRENT_RECORD IN CS1
    LOOP
    begin
    insert into t1.tr_dr1
    values
    (t1.tr_dr1_seq.nextval,CURRENT_RECORD.uuid,default,'ANY',DEFAULT,NULL,NULL,NULL,null);
    if CURRENT_RECORD.dv_code in('SD1','SD2') then
    INSERT INTO t1.dr1_writer
    values
    (t1.dr1_writer_feed_seq.nextval,CURRENT_RECORD.uuid,'OP1',DEFAULT,NULL,DEFAULT,NULL,null,DEFAULT,NULL);
    else
    INSERT INTO t1.dr1_writer
    values
    (t1.dr1_writer_feed_seq.nextval,CURRENT_RECORD.uuid,'OP2',DEFAULT,NULL,DEFAULT,NULL,null,DEFAULT,NULL);
    end if;
    exception
    WHEN DUP_VAL_ON_INDEX then
    dbms_output.put_line('IT IS NOT ALLOWED TO DUPLICATE');
    end;
    END LOOP;
    end;
    t1.V_TL_DR1 IS a view which has two columns uuid and dv_code
    Could any one tell me that, is it something to do with above procedure

    CREATE OR REPLACE VIEW t1.V_TL_DR1 AS
    select distinct ap.uuid uuid,ap.adv_code adv_code
    from
         (select alj.app_uid app_uid,alj.stages_uid stages_uid
         ,max(rate_AB) RATE_AB
         ,max(rate_Ac) RATE_AC
         ,max(rate_AD) RATE_AD
         ,MAX(CREATED) CREATED
         from t1.aof alj, (select max(uuid) uuid,max(in_name) in_name from t1.stages where stage=50 group by app_uid) st2
         where alj.stages_uid=st2.uuid
         group by alj.app_uid,alj.stages_uid) alj
         ,t1.app ap
         ,t1.app_user appu
         ,(select * from t1.app_applicant where joint='P') applicants
              WHERE
              alj.app_uid=ap.uuid
              and ap.user_uid=appu.uuid
              and ap.uuid=applicants.app_uid(+)
              and alj.created between systimestamp-(30/1440) and systimestamp-(10/1440)
              and ap.app_status='N'
              and
              (RATE_AB is not null and RATE_AB<>0)
              OR (RATE_AC not null and RATE_AC<>0)
              OR (RATE_AD is not null and RATE_AD<>0 and applicants.residential_status not in('T','U'))
              and appu.role='WEB'
              and ap.created between systimestamp-90 and systimestamp
              and ap.adv_code not in('UP1','UP2','UP3','UP4')Edited by: user605066 on 21-Feb-2011 02:32
    Edited by: user605066 on 21-Feb-2011 02:35

  • ORA-01410: invalid ROWID

    I was trying to load data into a table using SQL Loader
    when I came across this error in the log file . I am not sure what might have happened or where to look to fix this up. Any ideas or suggestions as to where to look? I am on Oracle 9.2.0.4 on unix(AIX 4.3)
    Thanks
    insert into med.orders a
    ERROR at line 1:
    ORA-01410: invalid ROWID

    My control file is as follows :
    load data
    append
    into table orders
    fields terminated by '|'
    (disc_telephone_number,
    order_number,
    due_date,
    completion_date,
    status,
    ocn,
    region CONSTANT "TOC",
    pon,
    start_date,
    start_time,
    technician,
    phone_number,
    actual_time)
    Actually my shell script does some updates and then inserts records into the table using sqlldr.
    First the updates which works fine...but during insert, it just hangs.
    1260 rows updated.
    Commit complete.
    It was supposed to do the insert and then again commit. (About 2500 records),,,but should take only about 20 minutes...(i compared this to my 8i environment.)But it just sits there, and when I cancel after a long gap of time it gives me the ORA error message saying
    Insert into orders ( .........)
    User requested cancel of operation
    Any suggestions ? Thanks

  • ORA-01410 Invalid RowID. Help me..

    Hi,
    I'm getting ORA-01410 error while trying to backup table X.
    (table X has no indexes.)
    what i did..
    1) using exp... --> ORA-01410 error
    2) create table X2 as select * from X --> ORA-01410 error
    3) alter table X move tablespace T2 --> ORA-01410 error
    4) analyze table X validate structure cascade --> ORA-01410 error
    maybe corruption?
    what i did next..
    1) fsck --> OK
    2) dbv file=XXX BLOCKSIZE=8192 (all datafiles) -> OK
    3) dbms_repair.check_object(...) -> OK
    i cannot understand this case.
    it's not the case of index corruption or "current of" bug.
    My environment is...
    - OS : Fedora Core 4
    - DB : Oracle 9.2.0.8 for Linux
    Can somebody tell me how i should repair this table?

    Table size is 4,197,449,728 (about 4GB) and 512,384 blocks (1block = 8KB)
    as I mentioned before, create as select statement was failed.
    at the view "v$longops" ,
    I can see progress of full scanning..
    from 0 block to 451341 block...
    but, there the ORA-01410 error is raised.

  • Invalid rowid error while running the snapshot agent in transactional replication

    Hi All,
    I am getting an Invalid rowid error while replicating an large tables i.e around 30 millions rows from oracle(publisher) to sql server(Subscriber) while running the snapshot agent in transactional replication.
    Its taking around 18 hours and its then its throwing this error.
    Is there any faster way that i can replicate the initial snapshot this large table as 18 hours is very high on time.
    Kindly suggest.i am always got quick and accurate response always..hope the same in this case also.
    Thanks,

    Hi,
    Could you please create a replication with some small tables for a test?
    You can disable the firewall on both sides and rerun snapshot. Enable verbose logging to level 4 for snapshot agent and check the results if it fails.
    http://support.microsoft.com/kb/312292
    Here is a document says for the error: ORA-10632: Invalid rowid Cause: Segment Highwatermark was overwritten due to shrink and space reused Action: Reissue this command.
    I also suggest you contact the Oracle support team for further help.
    Thanks.
    Tracy Cai
    TechNet Community Support

  • Invalid Rowid Error on Insert Row

    I have a table on which i don't have any primary key defined (or don't want to define any primary key on it). The EO has therefore ROWID generated by wizard as primary key. Every thing works alright on updating records. But during the insert i get a error "Unable to save the changes oracle.jbo.DMLException: JBO-26080: Error while selecting entity for PeriodSourceEO". BTW i am using following code to insert a row.
    PeriodVOImpl perGlobalVO = getPeriodVO();
    PeriodVORowImpl perGlobalRow = (PeriodVORowImpl) perGlobalVO.createRow();
    perGlobalRow.setNewRowState(Row.STATUS_NEW);
    perGlobalVO.insertRow(perGlobalRow);
    perGlobalVO.setCurrentRow(perGlobalRow);
    I get the error on committing the transaction.
    The error trace is
    <BaseSQLBuilderImpl> <doRefreshSQL> [14182] Executing Refresh SQL...SELECT ROWID FROM TPOVPERIODSOURCE WHERE ROWID=?
    <BaseSQLBuilderImpl> <bindWhereAttrValue> [14183] Where binding param 1: 686984
    <BaseSQLBuilderImpl> <doRefreshSQL> [14184] SQL failure in doRefreshSQL - 'ORA-01410: invalid ROWID
    Is insert not possibler using ROWID and I have to define a primary key to table? Or can someone point out workaround to it.

    Got the way to work around the problem. Just override the method protected void doRefreshSQL(int operation, java.util.ArrayList refreshAttrs) in the implementation of EntityImpl class.

  • Getting invalid ROWID Error

    Hi I am trying to insert data in a table and getting following error message.
    There is no primary key in the table so I have to choose rowId as primary key and when in Process From request method I am calling the AM method for code commit(), I am getting this error.
    oracle.apps.fnd.framework.OAException: oracle.jbo.DMLException: JBO-26080: Error while selecting entity for TestEO
    java.sql.SQLException: ORA-01410: invalid ROWID
    Thanks
    Anoop

    Anoop,
    If this is a custom table, y can't u have a primary key column. You can have that column as sequence.I think TAR won't help here, because in current version of BC4J this is a issue, and thats y Oracle says to have a primary key column in EO.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Error: ORA-01722: invalid number performing List of Values query.

    when i created a cascading select list, For the first time it worked properly then little later
    it is giving this error.
    Error: ORA-01722: invalid number performing List of Values query: "select distinct cl_name d, cl_no r from Kclient where gr_no = :P1_GRNO order by 1
    could any one please solve the problem?
    2. when i run the application. in all the items edit button is automatically seen
    including in the login screen.
    could any one identify what is the error and give me a solution.

    Is this better?
    select DISTINCT FIRST_NAME||' '||LAST_NAME display_value
          , ROW_ID return_value
      from "PSA_RESOURCE_MANAGER"
    where PSA_RESOURCE_MANAGER.ACTIVE_FLAG='Y'
       AND :P117_REPORTING_MANAGER = PSA_RESOURCE_MANAGER.REPORTING_MANAGER
       AND :P117_REPORTING_MANAGER <> -1 order by 1or
    select DISTINCT FIRST_NAME||' '||LAST_NAME display_value
          , ROW_ID return_value
      from "PSA_RESOURCE_MANAGER"
    where PSA_RESOURCE_MANAGER.ACTIVE_FLAG='Y'
       AND :P117_REPORTING_MANAGER = PSA_RESOURCE_MANAGER.REPORTING_MANAGER
       AND :P117_REPORTING_MANAGER != '-1' order by 1Is ROW_ID a column in your table by the way? If not, you should use ROWID (without the underscore)

  • ORA-01722: invalid number - Error during implicit conversion (10g vls 11g)

    I am facing oracle error for few SELECT queries in 11g which were working fine in 10g environment.
    Oracle Version:
    10g - 10.2.0.5.0
    11g - 11.2.0.3.0
    We are storing numeric values under CHAR or VARCHAR2 column in few tables. This is known design issue & it can't be changed for now.
    I know this will work fine until all the data is numeric in those columns for respective table. Because by some reason, if any row got character value for that column then implicit string to number conversion will fail and this error can occur. But I have verified that there is no data issue.
    But I can see difference in the execution plan! But not able to recognize the reason issue.
    Any other pointers on why the queries are failing in 11g would be of great help..
    Example SQL:
    Note that table structure and data is same in both the environments.
    View Definition -
    CREATE OR REPLACE FORCE VIEW CIMSOS.LC_LOCATIONS
    (   COUNTRY_ID,    PRODUCTID,
       LANGUAGE_ID,   LOCATION_NAME,
       LOCATION_SHORT_NAME,   TAG_ID,   LOCATION_DEFINITION,
       COMPOSITEKEY,   GLOBAL_LOCATION_KEY,
       CPRODUCTKEYID,   CMODVERSION)
    AS
       SELECT
              CCOUNTRY_ID AS COUNTRY_ID,
              CPRODUCTID AS PRODUCTID,
              CLANGUAGE_CODE AS LANGUAGE_ID,
              CLOCATION_NAME AS LOCATION_NAME,
              CLOCATION_SHORT_NAME AS LOCATION_SHORT_NAME,
              CTAG_ID AS TAG_ID,
              CLOCATION_DEFINITION AS LOCATION_DEFINITION,
              CCOMPOSITEKEY AS COMPOSITEKEY,
              CGLOBAL_LOCATION_KEY0 AS GLOBAL_LOCATION_KEY,
              cproductkeyid,
              cmodversion
         FROM mct_35193, goldencopy
        WHERE     cproductkeyid = productkey
              AND cmodversion = version
              AND catalogid = 35193;Facing issue for SQL query based on above view:
    ** In 10g Env
    SELECT * FROM LC_LOCATIONS WHERE productid = 75;
    -- It executes successfully and provide required results.
    Explain Plan:
    SELECT STATEMENT  ALL_ROWSCost: 12  Bytes: 416  Cardinality: 4                 
         4 NESTED LOOPS  Cost: 12  Bytes: 416  Cardinality: 4            
              1 INDEX RANGE SCAN INDEX CIMSOS.GOLDENCOPY_INDX1 Cost: 10  Bytes: 30,225  Cardinality: 2,015       
              3 TABLE ACCESS BY INDEX ROWID TABLE CIMSOS.MCT_35193 Cost: 1  Bytes: 89  Cardinality: 1       
                   2 INDEX UNIQUE SCAN INDEX (UNIQUE) CIMSOS.XPK_MCT_34342 Cost: 0  Cardinality: 1  ** In 11g Env
    SELECT * FROM LC_LOCATIONS WHERE productid = 75;
    ORA-01722: invalid number
    Explain Plan:
    SELECT STATEMENT  ALL_ROWSCost: 40  Bytes: 8,692  Cardinality: 82            
         3 NESTED LOOPS  Cost: 40  Bytes: 8,692  Cardinality: 82       
              1 TABLE ACCESS FULL TABLE CIMSOS.MCT_35193 Cost: 22  Bytes: 819  Cardinality: 9 
              2 INDEX RANGE SCAN INDEX CIMSOS.GOLDENCOPY_INDX1 Cost: 2  Bytes: 135  Cardinality: 9 
    -- Executes when value is passed as character.
    SELECT * FROM LC_LOCATIONS WHERE productid = '75';

    The problem doesn't appear to be related to the Oracle version, at least not directly. If your query plan does the string to number conversion before eliminating the rows that have non-numeric data, you'll get an error. If the query plan eliminates the rows that have non-numeric data before doing the conversion, the query will succeed. It is entirely possible that you'd get the "bad" plan in 10g or the "good" plan in 11g.
    You can capture the query plans from your 10g database and move them over to the 11g database. Oracle has a nice white paper on upgrading from 10g to 11g that walks you through that process.
    Of course, you really don't want to be dependent on the optimizer picking the "right" plan, you really want to fix the underlying data model issue.
    Justin

  • ORA-01722: invalid number error with Bulk collect

    Hi ,
    I have been using the script to delete old seasonal data from my application DB tables. The stored procedure has been created successfully but when i try to run the proc it has been throwing 'ORA-01722: invalid number' exception at line 'FETCH C1_CUR BULK COLLECT INTO C1_TYPE_VAR LIMIT v_bulklimit;'.
    Could you please help me here?
    Below is the stored proc:
    CREATE OR REPLACE PROCEDURE clean_old_season_data(P_SEASON VARCHAR2) AS
    CURSOR C1_CUR IS SELECT ROWID RID,pro.* FROM PROPS pro where pro.ITEMPK IN
    (SELECT sve.pk FROM SAVEDVALUEENTRY sve WHERE sve.p_parent IN
    (SELECT s.pk FROM SAVEDVALUES s WHERE s.P_MODIFIEDITEM IN
    (SELECT a.PK
    FROM products a
    WHERE a.p_season IN (select s.pk from Seasons s where s.P_code=P_SEASON)
    ) ) ) and rownum<5;
    CURSOR C2_DEL IS SELECT RID FROM PROPS_HISTORY;
    TYPE C1_TYPE IS TABLE OF C1_CUR%ROWTYPE;
    C1_TYPE_VAR C1_TYPE;
    TYPE C2_TYPE IS TABLE OF UROWID;
    C2_TYPE_VAR C2_TYPE;
    ex_dml_errors EXCEPTION;
    PRAGMA EXCEPTION_INIT(ex_dml_errors, -24381);
    l_error_count NUMBER;
    err_num NUMBER;
    err_msg VARCHAR2 (300);
    COMMIT_VARIABLE PLS_INTEGER:=0;
    v_bulklimit NUMBER:=2;
    BEGIN
    /*------------------ Data Selection and INSERTION IN HISTORY TABLE ---------------------------------------*/
    OPEN C1_CUR;
    LOOP
    DBMS_OUTPUT.put_line('Cursor opend now in loop');
    FETCH C1_CUR BULK COLLECT INTO C1_TYPE_VAR LIMIT v_bulklimit;//ERROR OCCURS HERE
    DBMS_OUTPUT.put_line('Cursor count is'|| C1_TYPE_VAR.COUNT);
    FORALL I IN 1..C1_TYPE_VAR.COUNT SAVE EXCEPTIONS
    INSERT INTO PROPS_HISTORY VALUES C1_TYPE_VAR(I);
    COMMIT_VARIABLE := COMMIT_VARIABLE + v_bulklimit;
    DBMS_OUTPUT.put_line('Commit variable'|| COMMIT_VARIABLE.COUNT);
    IF COMMIT_VARIABLE = v_bulklimit THEN
    COMMIT;
    COMMIT_VARIABLE := 0;
    END IF;
    EXIT WHEN C1_CUR%NOTFOUND;
    END LOOP;
    DBMS_OUTPUT.put_line('Cursor closed now in loop and data inserted in history table');
    CLOSE C1_CUR;
    /*------------------ Data Selection and DELETION IN Live TABLE ---------------------------------------*/
    COMMIT_VARIABLE := 0;
    OPEN C2_DEL;
    LOOP
    FETCH C2_DEL BULK COLLECT INTO C2_TYPE_VAR LIMIT 2;
    FORALL I IN 1..C2_TYPE_VAR.COUNT SAVE EXCEPTIONS
    DELETE FROM PROPS WHERE ROWID = C2_TYPE_VAR(I);
    COMMIT_VARIABLE := COMMIT_VARIABLE + 2;
    IF COMMIT_VARIABLE = 2 THEN
    COMMIT;
    COMMIT_VARIABLE := 0;
    END IF;
    EXIT WHEN C2_DEL%NOTFOUND;
    END LOOP;
    CLOSE C2_DEL;
    END;

    Although there are many things which should not have been done in the posted code, I could not find any reason why the Invalid number error should occur at the Fetch clause.
    I would suggest you to Insert into Table by providing the Order of Columns i.e. Insert into table (col1, ... colN) values (coll(i).col1...col(i).colN);
    I tested below code and it did not give any errors.
    drop table test_table;
    create table test_Table
      rid   varchar2(100),
      emp_id  number(5),
      fname   varchar2(20),
      lname   varchar2(50)
    set serveroutput on;
    declare
      cursor c_cur is
          select rowid rid, e.*
            from employees e
           where rownum < 10;
      type typ_cur is table of c_cur%rowtype;
      typ typ_cur;
      l_bulk_limit    number := 5;
    begin
      open c_cur;
      loop
        fetch c_cur bulk collect into typ limit l_bulk_limit;
        dbms_output.put_line('Collection Count :: ' || typ.count);
        forall i in 1..typ.count --typ.first..typ.last
          insert into test_Table (rid, emp_id, fname, lname) values (typ(i).rid,typ(i).employee_id,typ(i).first_name,typ(i).last_name);
        dbms_output.put_line('Processed ' || l_bulk_limit || ' records.');
        exit when c_cur%notfound;
      end loop;
      commit;
    end;
    select * from test_table;PS:- 1. When you are processing only 4 Records, then why are you breaking them in 2 Loops?
    2. Why Commit every time you are processing a DML? Why not maintain an Error Flag and Rollback the Transaction as soon as error is encountered?
    3. Use "{code}" (Exclude Double Quotes) to format the code. I am not sure if works.
    Regards,
    P.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • SQL Statement error - ORA-00903: invalid table name

    Hi
    I have written a sql script that gets executed from a form within e-business suite. Unfortunately, the script is falling over with an error:
    unknown command beginning "MERGE INTO..." - rest of line ignored.
    unknown command beginning "USING edop..." - rest of line ignored.
    unknown command beginning "ON (elw.ro..." - rest of line ignored.
    unknown command beginning "WHEN MATCH..." - rest of line ignored.
    For a list of known commands enter HELP
    and to leave enter EXIT.
          SET ELW.billed_flag          = t.billed_flag,
    ERROR at line 2:
    ORA-00903: invalid table name the actual statement that is causing the issue is:
    MERGE INTO edopaif.table1 elw
    USING edopaif.tablw2 t
    ON (elw.rowid = t.LOAD_WORKING_ROWID)
    WHEN MATCHED THEN
       UPDATE
          SET ELW.billed_flag          = t.billed_flag,
              ELW.last_bill_generated   = t.last_bill_generated,
              ELW.last_bill_type        = t.last_bill_type,
              ELW.load_month            = t.load_month,
              ELW.BILL_TRANSACTION_ID   = t.bill_transaction_id
    WHEN NOT MATCHED THEN
       INSERT(error_meaning)
       VALUES('ROWID error with ins_ptia');The version of e-business suite that we are using is: 11.5.10.2.
    The version of the Oracle database that we are using is:
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    PL/SQL Release 9.2.0.6.0 - Production
    CORE 9.2.0.6.0 Production
    TNS for IBM/AIX RISC System/6000: Version 9.2.0.6.0 - Production
    NLSRTL Version 9.2.0.6.0 - Production
    Please note that I am able to successfully run the statement directly connected as the APPS schema in the database - the error only occurs when the script is run from the forms front-end (which is really confusing me).
    Many thanks
    Paul

    Hi
    I've modified the script to include only the statement that is erroring and it still errors when executed from the front end application.
    Next I re-wrote the statement to use PL/SQL instead of the MERGE statement, to do the update, and the script completes succesfully, i.e.:
    DECLARE
       CURSOR cu_lw IS
             SELECT t.billed_flag,
                    t.last_bill_generated,
                    t.last_bill_type,
                    t.load_month,
                    t.bill_transaction_id,
                    t.load_working_rowid
               FROM table2 t;
    BEGIN
       FOR rec_cu_lw IN cu_lw LOOP
          UPDATE table1 elw
             SET ELW.billed_flag           = rec_cu_lw.billed_flag,
              ELW.last_bill_generated      = rec_cu_lw.last_bill_generated,
              ELW.last_bill_type           = rec_cu_lw.last_bill_type,
              ELW.load_month               = rec_cu_lw.load_month,
              ELW.BILL_TRANSACTION_ID      = rec_cu_lw.bill_transaction_id
          WHERE elw.rowid                  = rec_cu_lw.load_working_rowid;
       END LOOP;
    END;
    /I am still unsure as to why the MERGE statement is failing when executed in the front end, but completes in the backend with no issues at all. Obviously I would prefer to use the MERGE statement instead of PL/SQL to do the update.
    Thanks
    Paul

  • Best way to solve ORA-01722: invalid number

    Hi,
    I recently had to debug a large Merge statement that was getting 'ORA-01722: invalid number' and I found the only way to do it was comment out the columns until I found the culprit :-(
    Surely in this day and age there is a better way to do this? Oracle knows which column fails so it there a way of finding it more quickly?
    We are using Oracle 9.2
    Thanks for any top tips
    Regards
    Gary

    you can do a cursor and trap the exception
    create table t1 as select '1' col1, '2' col2 from dual union all select '1','x' from dual union all select 'x','2' from dual union all select 'x','x' from dual;
    declare
      cursor c1 is select rowid,col1,col2 from t1;
      dummy number;
    begin
      for r1 in c1 loop
        begin
          select to_number(r1.col1) into dummy from dual;
        exception
          when INVALID_NUMBER then
            dbms_output.put_line(r1.rowid||' col1='||r1.col1);
          end;
        begin
          select to_number(r1.col2) into dummy from dual;
        exception
          when INVALID_NUMBER then
            dbms_output.put_line(r1.rowid||' col2='||r1.col2);
        end;
      end loop;
    end;
    AAAKGCAAEAAAAECAAB col2=x
    AAAKGCAAEAAAAECAAC col1=x
    AAAKGCAAEAAAAECAAD col1=x
    AAAKGCAAEAAAAECAAD col2=xHTH
    Laurent Schneider
    OCM DBA

Maybe you are looking for