Paralell in enable unique constraint

TO use the feature of EXCEPTION into when creating unique index, I run the folllwing command to enable a unique constraints:
alter table TEST_DUP2 enable constraint UNQ_TEST_DUP2     
using index tablespace EDWSALESINDEX nologging
EXCEPTIONS into exceptions
This will create the unique index and when duplicate uniqe key encountered, the command fails and store the rowid of the duplicating row to exceptions table.
Now I want to run this commnad in parallel to enhance performance. I tried
alter table TEST_DUP2 enable constraint UNQ_TEST_DUP2     
using index tablespace EDWSALESINDEX nologging PARALLEL
EXCEPTIONS into exceptions
and I got SQL Error: ORA-00933: SQL command not properly ended.
Can this be done, or are there any worka around ?
I do not want create unique index explicitly as that does not have the EXCEPTION into feature.
Thanks

Here is an example for exceptions,
SQL> create table e( a number);
Table created.
SQL> alter table add constraint a_uk unique(a);
alter table add constraint a_uk unique(a)
ERROR at line 1:
ORA-00903: invalid table name
SQL> alter table e add constraint a_uk unique(a);
Table altered.
SQL> alter table e modify constraint a_uk disable;
Table altered.
SQL> host
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Aman>d:
D:\>cd oracle\product\11.1.0\db_1\RDBMS\ADMIN
D:\oracle\product\11.1.0\db_1\RDBMS\ADMIN>exit
SQL> @utlexcpt.sql
SP2-0310: unable to open file "utlexcpt.sql"
SQL> host dir utlex*
Volume in drive C is VAIO
Volume Serial Number is 54A5-8EF0
Directory of C:\Documents and Settings\Aman
File Not Found
SQL> host dir utl*
Volume in drive C is VAIO
Volume Serial Number is 54A5-8EF0
Directory of C:\Documents and Settings\Aman
File Not Found
SQL> hist
SP2-0042: unknown command "hist" - rest of line ignored.
SQL> host
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Aman>d:\oracle\product\11.1.0\db_1\RDBMS\ADMIN
'd:\oracle\product\11.1.0\db_1\RDBMS\ADMIN' is not recognized as an internal or extern
operable program or batch file.
C:\Documents and Settings\Aman>cd d:\oracle\product\11.1.0\db_1\RDBMS\ADMIN
C:\Documents and Settings\Aman>sqlplus aman/aman
SQL*Plus: Release 11.1.0.6.0 - Production on Mon Sep 15 22:02:20 2008
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
SQL>
SQL> d:\oracle\product\11.1.0\db_1\RDBMS\ADMIN
SP2-0734: unknown command beginning "d:\oracle\..." - rest of line ignored.
SQL> @d:\oracle\product\11.1.0\db_1\RDBMS\ADMIN\utlexcpt.sql
Table created.
SQL> insert into e values(1);
1 row created.
SQL> /
1 row created.
SQL> /
1 row created.
SQL> alter table e modify constraint a_uk  enable validate exceptions into exceptions;
alter table e modify constraint a_uk  enable validate exceptions into exceptions
ERROR at line 1:
ORA-02299: cannot validate (AMAN.A_UK) - duplicate keys found
SQL> select * from exceptions;
ROW_ID             OWNER                          TABLE_NAME
CONSTRAINT
AAARXIAAGAAAAAVAAC AMAN                           E
A_UK
AAARXIAAGAAAAAVAAB AMAN                           E
A_UK
AAARXIAAGAAAAAVAAA AMAN                           E
A_UK
SQL> select * from exceptions;Its on 11106.The same must work on pre 11g also.Do this and let me know.
Yup,Parallel is unimplemented surely enough,
SQL> alter table e
  2  enable validate constraint a_uk using index  tablespace nologging parallel;
enable validate constraint a_uk using index  tablespace nologging parallel
ERROR at line 2:
ORA-03001: unimplemented featureAnd here is the reason for it,
http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_3001.htm#i2054940
The clause Parallel is not a right clase for this command.
Hope this helps
Aman....
Edited by: Aman.... on Sep 15, 2008 10:08 PM

Similar Messages

  • Unique constraint violation on version enabled table

    hi!
    we're facing a strange problem with a version enabled table that has an unique constraint on one column. if we rename an object stored in the table (the name-attribute of the object is the one that has a unique constraint on the respective column) and rename it back to the old name again, we get an ORA-00001 unique constraint violation on the execution of an update trigger.
    if the constraint is simply applied as before to the now version enabled table, I understand that this happens, but shouldn't workspace manager take care of something like that when a table with unique constraints is version enabled? (the documentation also says that) because taking versioning into account it's not that we try to insert another object with the same name, it's the same object at another point in time now getting back it's old name.
    we somewhat assume that to be a pretty standard scenario when using versioned data.
    is this some kind of bug or do we just miss something important here?
    more information:
    - versioning is enabled on all tables with VIEW_WO_OVERWRITE and no valid time support
    - database version is 10.2.0.1.0
    - wm installation output:
    ALLOW_CAPTURE_EVENTS OFF
    ALLOW_MULTI_PARENT_WORKSPACES OFF
    ALLOW_NESTED_TABLE_COLUMNS OFF
    CR_WORKSPACE_MODE OPTIMISTIC_LOCKING
    FIRE_TRIGGERS_FOR_NONDML_EVENTS ON
    NONCR_WORKSPACE_MODE OPTIMISTIC_LOCKING
    NUMBER_OF_COMPRESS_BATCHES 50
    OWM_VERSION 10.2.0.1.0
    UNDO_SPACE UNLIMITED
    USE_TIMESTAMP_TYPE_FOR_HISTORY ON
    - all operations are done on LIVE workspace
    any help is appreciated.
    EDIT: we found out the following: the table we are talking about is the only table where the unique constraint is left. so there must have been a problem during version enabling. on another oracle installation we did everything the same way and the unique constraint wasn't left there, so everything works fine.
    regards,
    Andreas Schilling
    Message was edited by:
    aschilling

    hi!
    we're facing a strange problem with a version enabled table that has an unique constraint on one column. if we rename an object stored in the table (the name-attribute of the object is the one that has a unique constraint on the respective column) and rename it back to the old name again, we get an ORA-00001 unique constraint violation on the execution of an update trigger.
    if the constraint is simply applied as before to the now version enabled table, I understand that this happens, but shouldn't workspace manager take care of something like that when a table with unique constraints is version enabled? (the documentation also says that) because taking versioning into account it's not that we try to insert another object with the same name, it's the same object at another point in time now getting back it's old name.
    we somewhat assume that to be a pretty standard scenario when using versioned data.
    is this some kind of bug or do we just miss something important here?
    more information:
    - versioning is enabled on all tables with VIEW_WO_OVERWRITE and no valid time support
    - database version is 10.2.0.1.0
    - wm installation output:
    ALLOW_CAPTURE_EVENTS OFF
    ALLOW_MULTI_PARENT_WORKSPACES OFF
    ALLOW_NESTED_TABLE_COLUMNS OFF
    CR_WORKSPACE_MODE OPTIMISTIC_LOCKING
    FIRE_TRIGGERS_FOR_NONDML_EVENTS ON
    NONCR_WORKSPACE_MODE OPTIMISTIC_LOCKING
    NUMBER_OF_COMPRESS_BATCHES 50
    OWM_VERSION 10.2.0.1.0
    UNDO_SPACE UNLIMITED
    USE_TIMESTAMP_TYPE_FOR_HISTORY ON
    - all operations are done on LIVE workspace
    any help is appreciated.
    EDIT: we found out the following: the table we are talking about is the only table where the unique constraint is left. so there must have been a problem during version enabling. on another oracle installation we did everything the same way and the unique constraint wasn't left there, so everything works fine.
    regards,
    Andreas Schilling
    Message was edited by:
    aschilling

  • ORA-00001: unique constraint

    Hi,
    I disabled the primary key of the table to which I insert the data like this :
    INSERT INTO TABLE_X
    select * from table_1 UNION ALL
    select * from table_2 ;
    but I receive this error :
    ORA-00001: unique constraint TABLE_X.PK violated
    Why ? It is already disabled.
    thank you.
    Message was edited by:
    user522961
    Message was edited by:
    user522961
    Message was edited by:
    user522961

    Is it possible you kept the index when disabling the primary key?
    YAS@11G>create table t as select object_id from all_objects where rownum<=10;
    Table created.
    YAS@11G>alter table t add constraint PK_T primary key(object_id);
    Table altered.
    YAS@11G>alter table t disable constraint pk_t;
    Table altered.
    YAS@11G>insert into t select * from t;
    10 rows created.
    YAS@11G>rollback;
    Rollback complete.
    YAS@11G>alter table t enable constraint pk_t;
    Table altered.
    YAS@11G>alter table t disable constraint pk_t keep index;
    Table altered.
    YAS@11G>insert into t select * from t;
    insert into t select * from t
    ERROR at line 1:
    ORA-00001: unique constraint (YAS.PK_T) violated

  • ORA-00001: unique constraint @ impdp with table_exists_action=truncate

    Hi everybody
    I can't understand why my data pump import execution with parameter TABLE_EXISTS_ACTION=TRUNCATE returned ORA-00001 (unique constraint violation), while importing schema tables from a remote database where the source tables have the same unique constraints as the corresponding ones on the target database.
    Now my question is "If the table would be truncated, why I get unique constraint violation when inserting records from a table where the same unique constraint is validated?
    Here are the used parameter file content and the impdp logfile.
    parfile
    {code}
    DIRECTORY=IMPEXP_LOG_COLL2
    CONTENT=DATA_ONLY
    NETWORK_LINK=PRODUCTION
    PARALLEL=1
    TABLE_EXISTS_ACTION=TRUNCATE
    EXCLUDE=STATISTICS
    {code}
    logfile
    {code}
    Import: Release 10.2.0.1.0 - Production on Gioved� 22 Ottobre, 2009 15:33:44
    Copyright (c) 2003, 2005, Oracle. All rights reserved.
    Connesso a: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    FLASHBACK automatically enabled to preserve database integrity.
    Starting "IMPEXP"."PROVA_REFRESH_DBCOLL": impexp/********@dbcoll SCHEMAS=test_pump LOGFILE=test_pump.log parfile=refresh_dbcoll.par JOB_NAME=prova_refresh_dbcoll
    Estimate in progress using BLOCKS method...
    Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 523 MB
    ORA-31693: Table data object "TEST_PUMP"."X10000000_TRIGGER" failed to load/unload and is being skipped due to error:
    ORA-00001: unique constraint (TEST_PUMP.SYS_C00726627) violated
    ORA-31693: Table data object "TEST_PUMP"."X10000000_BASIC" failed to load/unload and is being skipped due to error:
    ORA-00001: unique constraint (TEST_PUMP.SYS_C00726625) violated
    Job "IMPEXP"."PROVA_REFRESH_DBCOLL" completed with 2 error(s) at 15:34:04
    {code}
    Thank you
    Bye Alessandro

    I forgot to read the last two lines of the documentation about TABLE_EXISTS_ACTION where it says:
    "TRUNCATE cannot be used on clustered tables or over network links."
    So it seems that it ignored the clause for the use of NETWORK_LINK and unreasonably opted for an APPEND action instead of throwing an error to highlight the conflicting parameters in the used configuration.
    Bye Alessandro

  • (Error) ORA-00001: unique constraint (WHSE_DBA.PK_DELPHI_TRANS_FACT) violat

    I have a stored proc which runs every night. The stored proc is giving a unique constraint violation.
    (Error) ORA-00001: unique constraint (WHSE_DBA.PK_DELPHI_TRANS_FACT) violated.
    Any idea about how to debug this.

    I want to create an error table on the stored proc shown below. I know I have to add something in the exceptions. Can anyone give me the commands and where to add it.
    CREATE OR REPLACE PROCEDURE WHSE_DBA.DM_LD_DELPHI_TRANS_FACT
    IS
    -- VARIABLE DECLARATIONS
    LAST_LOAD_DATE                   DATE;
    INSERTCOUNT                 NUMBER:=0;
    -- LOGGING VARIABLES AND CONSTANTS
    TARGETTABLE                 CONSTANT VARCHAR2(20):='DELPHI_TRANS_FACT';
    MSGUNKNOWNERR               CONSTANT VARCHAR2(20):='Error';
    NBRIGNOREERR                CONSTANT NUMBER:=12541;
    DEFDATE                     CONSTANT DATE:='01-OCT-2006';
    ERRDESCRIPTION              VARCHAR2(255);
    V_DELPHI_TRANS_TOTAL            NUMBER;
    V_DELPHI_TRANS_FACT_TOTAL   NUMBER;
    BEGIN
    -- LOOK UP LAST LOADED RECORD
    SELECT NVL(MAX(SNAPSHOT_DATE),DEFDATE)
    INTO LAST_LOAD_DATE
    FROM DELPHI_TRANS_FACT;
    -- * LOAD ALL DIMENSION TABLES
    -- BUDGET_YR_DIMENSION
    INSERT INTO BUDGET_YR_DIMENSION (BUDGET_YEAR, SNAPSHOT_DATE)
    (SELECT DISTINCT BUD_YR, SYSDATE
    FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM BUDGET_YR_DIMENSION
    WHERE BUDGET_YEAR=OUTER.BUD_YR));
    -- EFF_DATE_DIMENSION
    INSERT INTO EFF_DATE_DIMENSION (PAID_FIS_YEAR, PAID_QTR, EFFECTIVE_DATE, SNAPSHOT_DATE)
    (SELECT DISTINCT CVT_DATE_TO_FISCAL_YEAR(EFF_DT), PD_QTR, EFF_DT, SYSDATE
    FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM EFF_DATE_DIMENSION
    WHERE EFFECTIVE_DATE=OUTER.EFF_DT));
    -- PROC_DATE_DIMENSION
    INSERT INTO PROC_DATE_DIMENSION (PROCESS_DATE, SNAPSHOT_DATE)
    (SELECT DISTINCT PROC_DT, SYSDATE
    FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM PROC_DATE_DIMENSION
    WHERE PROCESS_DATE=OUTER.PROC_DT));
    -- ORG_DIMENSION
    INSERT INTO ORG_DIMENSION (ORG,COST_CTR,SNAPSHOT_DATE)
    (SELECT DISTINCT ORG, CC_CD, SYSDATE
    FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM ORG_DIMENSION
    WHERE ORG=OUTER.ORG));
    -- BPAC DIMENSION
    INSERT INTO BPAC_DIMENSION (BPAC, AFC_CD, PE_CODE, SNAPSHOT_DATE)
    (SELECT DISTINCT BPAC, AFC_CD, PE, SYSDATE
    FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM BPAC_DIMENSION
    WHERE BPAC=OUTER.BPAC));
    -- FUND DIMENSION
    INSERT INTO FUND_DIMENSION (FUND,APPROP_CD,LIM_CD,SNAPSHOT_DATE)
    (SELECT DISTINCT FUND, APPROP_CD, APPLIM_CD, SYSDATE
    FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM FUND_DIMENSION
    WHERE FUND=OUTER.FUND));
    -- OBJ_CD_DIMENSION
    INSERT INTO OBJ_CD_DIMENSION (OBJ_CD,SNAPSHOT_DATE)
    (SELECT DISTINCT OC_CD, SYSDATE
    FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM OBJ_CD_DIMENSION
    WHERE OBJ_CD=OUTER.OC_CD));
    -- GLA DIMENSION
    INSERT INTO GLA_DIMENSION (GLA_CD,SNAPSHOT_DATE)
    (SELECT DISTINCT GLA, SYSDATE FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM GLA_DIMENSION
    WHERE GLA_CD=OUTER.GLA));
    -- PROJECT_TASK_DIMENSION
    INSERT INTO PROJECT_TASK_DIMENSION (PROJECT_NO,TASK_NO,SNAPSHOT_DATE)
    (SELECT DISTINCT PROJ_NBR, TASK_NBR, SYSDATE FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM PROJECT_TASK_DIMENSION
    WHERE PROJECT_NO=OUTER.PROJ_NBR
      AND TASK_NO=OUTER.TASK_NBR));
    -- TRANS_DESC_DIMENSION
    INSERT INTO TRANS_DESC_DIMENSION (DESCRIPTION,SNAPSHOT_DATE)
    (SELECT DISTINCT DESCR, SYSDATE FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM TRANS_DESC_DIMENSION
    WHERE DESCRIPTION=OUTER.DESCR
    AND OUTER.DESCR IS NOT NULL));
    -- SUPPLIER_DIMENSION
    INSERT INTO SUPPLIER_DIMENSION (SUPPLIER_NAME, SNAPSHOT_DATE)
    (SELECT DISTINCT VENDOR_NAME, SYSDATE FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM SUPPLIER_DIMENSION
    WHERE SUPPLIER_NAME=OUTER.VENDOR_NAME));
    -- DELPHI_INV_DIMENSION
    INSERT INTO DELPHI_INV_DIMENSION (INVOICE_NO, SNAPSHOT_DATE)
    (SELECT DISTINCT INV_NO, SYSDATE FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM DELPHI_INV_DIMENSION
    WHERE INVOICE_NO=OUTER.INV_NO));
    -- DELPHI_PO_DIMENSION
    INSERT INTO DELPHI_PO_DIMENSION (PO_NO, SNAPSHOT_DATE)
    (SELECT DISTINCT PO_NO, SYSDATE FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM DELPHI_PO_DIMENSION
    WHERE PO_NO=OUTER.PO_NO));
    -- TEMPORARILY DISABLE KEY FOR FASTER LOADING
    DB_MISC.PRO_EXE_DDL('ALTER TABLE DELPHI_TRANS_FACT DISABLE CONSTRAINT PK_DELPH_TRANS_FACT');
        -- MOVE DATA INTO TABLE
         INSERT INTO DELPHI_TRANS_FACT (BPAC_KEY, ORG_KEY, FUND_KEY, OBJ_CD_KEY, GLA_KEY,
         EFF_DATE_KEY, PROC_DATE_KEY, PROJECT_TASK_KEY, BUDGET_YR_KEY, DELPHI_TRANS_DESC_KEY,
         BALANCE, COMMIT_AMT, UDO_AMT, AEU_AMT, AEP_AMT, OBLIGATION_AMT, SNAPSHOT_DATE,
         SUPPLIER_KEY, DELPHI_INV_KEY, DELPHI_PO_KEY)
         (SELECT BPAC_KEY, ORG_KEY, FUND_KEY, OBJ_CD_KEY, GLA_KEY, EFF_DATE_KEY, PROC_DATE_KEY,
         PROJECT_TASK_KEY, BUDGET_YR_KEY, TRANS_DESC_KEY, SUM(BAL), SUM(COMMIT_AMT), SUM(UDO_AMT),
         SUM(AEU_AMT), SUM(AEP_AMT), SUM(OBLIGATION_AMT), MAX(SYSDATE), SUPPLIER_KEY, DELPHI_INV_KEY,
         DELPHI_PO_KEY
         FROM BPAC_DIMENSION, ORG_DIMENSION, FUND_DIMENSION, OBJ_CD_DIMENSION, GLA_DIMENSION,
        EFF_DATE_DIMENSION, PROC_DATE_DIMENSION, PROJECT_TASK_DIMENSION, BUDGET_YR_DIMENSION,
         TRANS_DESC_DIMENSION, DELPHI_TRANS,     SUPPLIER_DIMENSION, DELPHI_INV_DIMENSION, DELPHI_PO_DIMENSION
         WHERE DELPHI_TRANS.SNAPSHOT_DATE>LAST_LOAD_DATE
         -- JOIN WITH BPAC_DIMENSION
        AND DELPHI_TRANS.BPAC=BPAC_DIMENSION.BPAC
         -- JOIN WITH ORG_DIMENSION
         AND DELPHI_TRANS.ORG = ORG_DIMENSION.ORG
         -- JOIN WITH FUND_DIMENSION
         AND DELPHI_TRANS.FUND = FUND_DIMENSION.FUND
         -- JOIN WITH OBJ_CD_DIMENSION
         AND DELPHI_TRANS.OC_CD=OBJ_CD_DIMENSION.OBJ_CD
         -- JOIN WITH GLA_DIMENSION
         AND  DELPHI_TRANS.GLA=GLA_DIMENSION.GLA_CD
         -- JOIN WITH EFF_DATE_DIMENSION
         AND DELPHI_TRANS.EFF_DT=EFF_DATE_DIMENSION.EFFECTIVE_DATE
         -- JOIN WITH PROC_DATE_DIMENSION
         AND DELPHI_TRANS.PROC_DT=PROC_DATE_DIMENSION.PROCESS_DATE
         -- JOIN WITH PROJECT_TASK_DIMENSION
         AND (DELPHI_TRANS.PROJ_NBR=PROJECT_TASK_DIMENSION.PROJECT_NO
         AND DELPHI_TRANS.TASK_NBR=PROJECT_TASK_DIMENSION.TASK_NO)
         -- JOIN WITH BUDGET_YR_DIMENSION
         AND DELPHI_TRANS.BUD_YR=BUDGET_YR_DIMENSION.BUDGET_YEAR          
         -- JOIN WITH  TRANS_DESC_DIMENSION
         AND DELPHI_TRANS.DESCR=TRANS_DESC_DIMENSION.DESCRIPTION
         -- JOIN WITH SUPPLIER_DIMENSION
         AND DELPHI_TRANS.VENDOR_NAME=SUPPLIER_DIMENSION.SUPPLIER_NAME
         -- JOIN WITH DELPHI_PO_DIMENSION
         AND DELPHI_TRANS.PO_NO=DELPHI_PO_DIMENSION.PO_NO
         -- JOIN WITH DELPHI_INV_DIMENSION
         AND DELPHI_TRANS.INV_NO=DELPHI_INV_DIMENSION.INVOICE_NO
         GROUP BY BPAC_KEY, ORG_KEY, FUND_KEY, OBJ_CD_KEY, GLA_KEY, EFF_DATE_KEY, PROC_DATE_KEY,
         PROJECT_TASK_KEY, BUDGET_YR_KEY,TRANS_DESC_KEY, SUPPLIER_KEY, DELPHI_INV_KEY, DELPHI_PO_KEY);
    -- COUNT AFFECTED RECORDS
    INSERTCOUNT:=0+SQL%ROWCOUNT;
    -- RE-ENABLE KEY CONSTRAINT
    DB_MISC.PRO_EXE_DDL('ALTER TABLE DELPHI_TRANS_FACT ENABLE VALIDATE CONSTRAINT PK_DELPH_TRANS_FACT');
    -- STORE RESULTS OF OPERATION
    IF INSERTCOUNT>0 THEN
      DB_MISC.LOGFAILURE_EX('none', 'none', INSERTCOUNT||' new records loaded successfully.', TARGETTABLE, 'DM_LD_DELPHI_TRANS_FACT', FALSE);
    END IF;
    --- COMPARE BALANCE TOTAL FROM DELPHI_TRANS TABLE AND DELPHI_TRANS_FACT TABLE
    SELECT SUM(BAL) INTO V_DELPHI_TRANS_TOTAL
    FROM DELPHI_TRANS ;
    SELECT SUM(BALANCE) INTO V_DELPHI_TRANS_FACT_TOTAL
    FROM DELPHI_TRANS_FACT ; 
    VALIDATE_LOAD(V_DELPHI_TRANS_TOTAL,V_DELPHI_TRANS_FACT_TOTAL); 
    -- EXCEPTION HANDLING ROUTINES * * * * * * * * * * * * * * * * * * * * * *
    EXCEPTION
        WHEN OTHERS THEN
          ROLLBACK;
          IF SQLCODE!=NBRIGNOREERR THEN
            ERRDESCRIPTION:=SQLERRM;
            -- CALL ROUTINE TO PROCESS ERROR
            DB_MISC.LOGFAILURE_EX('none', 'none', ERRDESCRIPTION, TARGETTABLE, 'DM_LD_DELPHI_TRANS_FACT', TRUE);
            COMMIT;
          END IF;
    -- END EXCEPTION HANDLING ROUTINES * * * * * * * * * * * * * * * * * * * * * *
    END

  • How to create unique constraint on a col which has duplicate values

    Hi all,
    how can i create a unique constraint on a field which have duplicate vaules with no validate clause.
    My table name is "ACCT"
    Regards
    Message was edited by:
    53637

    Check out following
    SQL>DROP TABLE TEST;
    Table dropped.
    SQL>CREATE TABLE TEST
      2  (
      3     ID          NUMBER
      4    ,NAME        VARCHAR2(30)
      5    ,CITY        VARCHAR2(30)
      6  );
    Table created.
    SQL>INSERT INTO TEST VALUES(1,'Rajesh','Gurgaon');
    1 row created.
    SQL>INSERT INTO TEST VALUES(1,'Rajesh','Gurgaon');
    1 row created.
    SQL>INSERT INTO TEST VALUES(2,'Dinesh','Delhi');
    1 row created.
    SQL>INSERT INTO TEST VALUES(1,'Rajan','Pune');
    1 row created.
    SQL>INSERT INTO TEST VALUES(1,'Rajan','Pune');
    1 row created.
    SQL>COMMIT;
    Commit complete.
    SQL>ALTER TABLE test ADD CONSTRAINTS uk_on_test UNIQUE(ID,NAME,CITY) DEFERRABLE NOVALIDATE ;
    Table altered.
    SQL>ALTER TABLE test
      2  ENABLE NOVALIDATE CONSTRAINT uk_on_test;
    Table altered.
    SQL>INSERT INTO TEST VALUES(1,'Rajesh','Gurgaon');
    INSERT INTO TEST VALUES(1,'Rajesh','Gurgaon')
    ERROR at line 1:
    ORA-00001: unique constraint (AIP.UK_ON_TEST) violatedRegards
    Arun

  • HOWTO: Add a UNIQUE constraint to a populated column

    Here is the way to add a unique constraint to a populated column, ensuring that the existing values are unique as well.
    ALTER TABLE t1
    ADD CONSTRAINT t1_uk UNIQUE (col1,col2)
    EXCEPTIONS INTO my_exceptions
    /If the alter table statement fails this will populate the MY_EXCEPTIONS table with the rows that contain duplicate values for (col1,col2). These are identified by ROWID. We can then chose to:
    [list]
    [*]delete rows with a bad key;
    [*]amend the values of the key columns;
    [*]re-apply the constraint with the NOVALIDATE option.
    [list]
    We should be wary of choosing the NOVALIDATE option. There's usually a good reason why the unique constraint is required and we should not circumvent it. Apart from anything else, Oracle allows us to build foreign keys referencing NOVALIDATE unique keys. This could result in child rows that have two parents, which is normal in biology, but very wrong in a database.
    NOVALIDATE is useful in datawarehouses and suchlike, because little updating occurs and the data integrity issues are of less imporatance. I don't think it ought to be used in OLTP situations. The code example at the end of this posting illustrates why we should exercise caution with NOVALIDATE.
    Once we have handled the duplicate values we can re-run the alter table statement and apply the constraint.
    If you don't already have an EXCEPTIONS table (it can be called anything, it's the structure that counts) you may need to run (or get a DBA to run) a script called UTLEXCPT.SQL, which will be in the $ORACLE_HOME/rdbms/admin directory.
    Cheers, APC
    SQL> SELECT col1, col2, col3 FROM t1;
          COL1       COL2       COL3                                               
             1          1          0                                               
             2          1          0                                               
             2          1          0                                               
    SQL> SELECT col1, col2, cola FROM t2;
          COL1       COL2 COLA                                                     
             1          1  I'm child #1                                                        
             1          1  I'm child #2                                                        
             2          1  I'm child #3                                                        
    SQL> ALTER TABLE t1
      2  ADD CONSTRAINT t1_uk UNIQUE (col1, col2);
    ALTER TABLE t1 ADD CONSTRAINT t1_uk UNIQUE (col1, col2)
    ERROR at line 1:
    ORA-02299: cannot validate (TST2.T1_UK) - duplicate keys found We can't add a unique key, so we decide to use the NOVALIDATE clause.
    SQL> CREATE INDEX t1_i ON t1(col1, col2);
    Index created.
    SQL> ALTER TABLE t1
      2  ADD CONSTRAINT t1_uk UNIQUE (col1, col2) ENABLE NOVALIDATE;
    Table altered.
    SQL> INSERT INTO t1 VALUES (2, 1, 1);
    insert into t1 values (2, 1, 1)
    ERROR at line 1:
    ORA-00001: unique constraint (TST2.T1_UK) violated Well, we can't add any more duplicate keys, so that's alright isn't it? Nope. We can add a foreign key to table T2 referencing T1 but we don't know which row in T1 is the parent of the rows in T2.
    SQL> ALTER TABLE t2
      2  ADD CONSTRAINT t2_t1_fk foreign key  (col1, col2)
      3  REFERENCES t1(col1, col2)
    Table altered.
    SQL> SELECT rowid FROM t1 WHERE col1 = 2;
    ROWID                                                                          
    AAAVnMAANAAAB96AAB                                                             
    AAAVnMAANAAAB96AAC                                                             
    SQL> DELETE FROM t1 WHERE rowid = 'AAAVnMAANAAAB96AAB';
    1 row deleted.
    SQL> DELETE FROM t1 WHERE rowid = 'AAAVnMAANAAAB96AAC';
    DELETE FROM t1 WHERE rowid = 'AAAVnMAANAAAB96AAC'
    ERROR at line 1:
    ORA-02292: integrity CONSTRAINT (TST2.T2_T1_FK) violated - child record found
    SQL> ROLL
    Rollback complete.
    SQL> DELETE FROM t1 WHERE rowid = 'AAAVnMAANAAAB96AAC';
    1 row deleted.
    SQL> DELETE FROM t1 WHERE rowid = 'AAAVnMAANAAAB96AAB';
    DELETE FROM t1 WHERE rowid = 'AAAVnMAANAAAB96AAB'
    ERROR at line 1:
    ORA-02292: integrity CONSTRAINT (TST2.T2_T1_FK) violated - child record found
    SQL>  ROLL
    Rollback complete.
    Why this matters: queries joining child and parent tables return more rows than we'd expect normally.
    SQL> SELECT t2.cola
      2  FROM   t2
      3  WHERE  t2.col1 = 2
      4  and    t2.col2 = 1;
    COLA                                                                           
    I'm child #3                                                                   
    SQL> SELECT t2.cola, t1.col4
      2  FROM   t1, t2
      3  WHERE  t2.col1 = 2
      4  AND    t2.col2 = 1
      5  AND    t1.col1 = 2
      6  AND    t2.col2 = 1;
    COLA                    COL4                                                   
    I'm child #3            I'm the daddy                                          
    I'm child #3            No, I'm the daddy!!                                    
    SQL> Caveat emptor
    This posting is issued on behalf of the Rogue Moderators. It is posted with the best of intentions but is not guaranteed in any way, shape or form. In particular, the code is presented "as is" and you assume full responsibility for running it on your system. Furthermore, you must not download and install software from the internet unless you know what you are doing and have the permission of whoever owns your system. It was never this hard for the Lone Ranger.

    Hi,
    You can not create unique key with duplicate values as you know. Now if you want to create unique key then you have to delete duplicate records from the table but this again if you can afford to delete because this data may be more importante to you and you can not delete any record.
    or you can use ENABLE NOVALIDATE option of oracle explain by Tom on below link.
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:8806498660292
    or if you dont want to use Tom's way then you go with primary key like
    Drop old primary key if there is already on the column.
    create new primary key with enable novalidate option.

  • Unique constraint violation error

    Hello All,
    I have a procedure called - FHM_DASHBOARD_PROC which inserts the data into a table called FHM_DASHBOARD_F fetching records from several tables. However, for a particular type of record, that data is not being inserted because of the Unique constraint violation
    the procedure is:
    create or replace
    PROCEDURE FHM_DASHBOARD_PROC AS
    DB_METRICS_CNT1Z number;
    --V_PODNAME varchar2(10);
    V_KI_CODE_DB_STATSZ varchar2(50);
    V_ERRORSTRING varchar2(100);
    --CURSOR PODNAME_CUR IS SELECT PODNAME,SHORTNAME FROM CRMODDEV.POD_DATA WHERE PODSTATUS_ID=1 AND PODTYPE_ID=1 ORDER BY PODNAME;
    -- DB STATS
    BEGIN
      -- OPEN PODNAME_CUR;
        --   LOOP
          --   FETCH PODNAME_CUR INTO V_PODNAME,V_POD_SHORTNAME ;
            -- EXIT WHEN PODNAME_CUR%NOTFOUND;
               BEGIN
                     SELECT COUNT(*) INTO DB_METRICS_CNT1Z FROM FHM_DB_METRICS_F A, FHM_DB_D B where A.DBNAME=B.DBNAME and PODNAME=V_PODNAME AND DB_DATE=TRUNC(SYSDATE-1);
                               DBMS_OUTPUT.PUT_LINE('DB_METRICS_CNT1Z :'|| DB_METRICS_CNT1Z);
                               IF DB_METRICS_CNT1Z >0 THEN
                        DBMS_OUTPUT.PUT_LINE('DB STATS');
                       INSERT INTO FHM_DASHBOARD_F(PODNAME,DASH_DATE,KI_CODE,KI_VALUE,KI_STATUS)
                          (SELECT PODNAME, DASH_DATE AS CU_DATE, KI.KI_CODE, NVL(PF.KI_VALUE,0),
                                                                  CASE
                                                                   WHEN PF.KI_VALUE = ki.warning_threshold then 2
                        when PF.KI_VALUE=0 then 0
                        ELSE 1
                        END  AS ALERT_STATUS
                        FROM
                        (SELECT PODNAME,DB_DATE AS DASH_DATE,decode(a.stats_last_status,'SUCCEEDED',1,'FAILED',2,'STOPPED',2,NULL,0) KI_VALUE from 
                        FHM_DB_METRICS_F a,fhm_db_d b where a.dbname=b.dbname and podname='XYZ' and db_date=TRUNC(SYSDATE-1) and dbtype='OLTP')PF,
                        FHM_KEY_INDICATOR_D KI where PF.PODNAME=KI.POD_NAME AND KI.TIER_CODE=3 AND KI.KI_NAME='DB_STATS'
                        AND (PF.PODNAME,TRUNC(PF.DASH_DATE),KI.KI_CODE) NOT IN (SELECT PODNAME,DASH_DATE,KI_CODE FROM FHM_DASHBOARD_F));
                                 COMMIT;
                             ELSE
                                    SELECT KI_CODE INTO V_KI_CODE_DB_STATSZ FROM FHM_KEY_INDICATOR_D WHERE POD_NAME=V_PODNAME AND KI_NAME='DB_STATS';
                                     DBMS_OUTPUT.PUT_LINE('V_KI_CODE_DB_STATSZ :'||V_KI_CODE_DB_STATSZ);
                                     INSERT INTO FHM_DASHBOARD_F(PODNAME,DASH_DATE,KI_CODE,KI_VALUE,KI_STATUS) VALUES(V_PODNAME,TRUNC(SYSDATE-1),V_KI_CODE_DB_STATSZ,0,0);
                                     COMMIT;
                             END IF;
         EXCEPTION
                            WHEN OTHERS THEN
                            V_ERRORSTRING :='INSERT INTO FHM_DASHBOARD_F_ERROR_LOG(POD_NAME,KI_NAME,ERRORNO,ERRORMESSAGE,DATETIME) VALUES
                   ('''||V_PODNAME||''',''DB_STATS'','''||SQLCODE||''','''||SQLERRM||''',SYSDATE)';                        
                   EXECUTE IMMEDIATE  V_ERRORSTRING;
                            COMMIT;
              END;
          --END LOOP;
      --CLOSE PODNAME_CUR;
    END;
    END FHM_DASHBOARD_PROC;and the table where the data is inserting is
    CREATE TABLE "CRMODDEV"."FHM_DASHBOARD_F"
        "PODNAME" VARCHAR2(25 BYTE) NOT NULL ENABLE,
        "DASH_DATE" DATE,
        "KI_CODE"   NUMBER NOT NULL ENABLE,
        "KI_VALUE"  NUMBER,
        "KI_STATUS" NUMBER,
        CONSTRAINT "FHM_DASHBOARD_F_DATE_PK" PRIMARY KEY ("DASH_DATE", "PODNAME", "KI_CODE") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING COMPUTE STATISTICS STORAGE(INITIAL 4194304 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CRMODDEV_IDX" ENABLE,
        CONSTRAINT "FHM_DASHBOARD_F_KI_CODE_FK" FOREIGN KEY ("KI_CODE") REFERENCES "CRMODDEV"."FHM_KEY_INDICATOR_D" ("KI_CODE") ENABLE
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS NOLOGGING STORAGE
        INITIAL 3145728 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
      TABLESPACE "CRMODDEV_TBL" ENABLE ROW MOVEMENT ;the Primary key constraint is FHM_DASHBOARD_F_DATE_PK and is on 3 columns of the table DASH_DATE, PODNAME, KI_CODE
    And this is the query used in the Procedure for inserting the data into the table
    (SELECT  PODNAME, DASH_DATE AS CU_DATE, KI.KI_CODE, NVL(PF.KI_VALUE,0),
                                   CASE
                                   WHEN PF.KI_VALUE = ki.warning_threshold then 2
    when PF.KI_VALUE=0 then 0
    ELSE 1
    END  AS ALERT_STATUS
    From
    (Select  Podname,Db_Date As Dash_Date,Decode(A.Stats_Last_Status,'SUCCEEDED',1,'FAILED',2,'STOPPED',2,Null,0) Ki_Value From  -- Added Distinct
    FHM_DB_METRICS_F a,fhm_db_d b where a.dbname=b.dbname and podname in ('XYZ') and db_date = TRUNC(SYSDATE-2) and dbtype='OLTP')PF,
    Fhm_Key_Indicator_D Ki Where Pf.Podname=Ki.Pod_Name And Ki.Tier_Code=3 And Ki.Ki_Name='DB_STATS'
    And (Pf.Podname,Trunc(Pf.Dash_Date),Ki.Ki_Code) Not In (Select Podname,Dash_Date,Ki_Code From Fhm_Dashboard_F));It gives *2 record* as result
    XYZ 20-JAN-12     2521     1     1
    XYZ 20-JAN-12     2521     1     1
    So it gives Unique constraint violation error while inserting. Then, I changed in the above inserting code by adding a distinct clause. After that the query gives only ONE record as result. However, that record also is not being inserted into the table and giving the same error.
    Now the question is How shall I insert this record into the table successfully ?
    Though the message is too long, However, I have given you the full structure of the object/procedure and error.
    Thank You in Advance.

    when you have 5 columns in the result set adding DISTINCT is n ot the solution as you may get the same error again.
    Check the target table whether the data exists before inserting ..if not check the table structure for unique constraint created on other columns.
    select *from <table_name>
    where
    DASH_DATE=date '2012-01-20'
    and PODNAME='XYZ'
    and  KI_CODE=2521;

  • Toplink 10.1.3.1 Unique Constraint error

    Hi All,
    I'm working with toplink 10.1.3.1 using JDeveloper 10.1.3.1.
    When I'm using the Sequence in the toplink work bench, I'm getting the unique constraint error.
    What i did was, I checked the "Use sequencing" check box and filled the sequence name , table name and field in the toplink workbench wizard.
    And I kept true for "Use Native Sequencing" in the sequence of login tab for sessions.xml default file. And checked the preallocation Size and set to the minimum value of the sequence. I didn't checked the "Table", "Name Field" and "Counter Field" check boxes.
    The sequence is getting incremented for every execution. Its not getting the actual sequence current value. I don't know whether the value is getting cached.
    for example if the actual sequence number in the database is 1740
    but when I am running the toplink query It is generating the sequence number like 1738 and it is giving the Unique constraint when I am clicking on the button for three times (ie 1739,1740,1741)it is inserting successfully into the database.
    But when I am running the application again then it is generating the sequence number as 1739 I am unable to understand where I am going wrong.
    If I test The sequence in SQL Work Sheet it was working fine.
    could anyone suggest me the correct way of using the sequence in the toplink workbench.
    the Sequence was created using JDeveloper wizard with Increment 1.
    Thanks in advance,
    regards,
    Satish Dasari.

    Hi,
    Satish,Thanks for your reply.
    Let me tell the scenario. I have two tables A and B. First I am inserting an event_no in table A. and after that I read the data from table A including event_no and I am going to insert it into table B. Rarely I am getting an exception like Unique constraint violation error.
    I kept native sequencing true,preallocation size 1, Min value=1, Max-value=9999999, increment by 1, cache size=10, Enabled refresh only if new version.
    What are all the values that i need to be changed in order to recover from this error. Our application is running in a load balancing environment.
    Note: I am not able to simulate this in my desktop environment.
    Regards,
    P.Prasanna.

  • Put a unique constraint on column if duplicate data is already present

    how to put a unique constraint on column if duplicate data is already present in that column?

    Hello,
    I have Oracle 10g and in this version documentation (SQL Reference) just says
    ENABLE NOVALIDATE ensures that all new DML operations on the constrained data comply with the constraint. This clause does not ensure that existing data in the table complies with the constraint and therefore does not require a table lock.
    So, as far as I understand, it does not guarantee that the constraint is really not validated:
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
    Connected as xxxx
    SQL>
    SQL> create table drop_me as
      2  select 1 as id from dual
      3  union all
      4  select 1 as id from dual;
    Table created
    SQL> alter table drop_me
      2  add constraint unq_id unique (id) enable novalidate;
    alter table drop_me
    add constraint unq_id unique (id) enable novalidate
    ORA-02299: cannot validate (XXXX.UNQ_ID) - duplicate keys found
    SQL>

  • ENABLE NOVALIDATE CONSTRAINT SYNTAX

    Hi,
    I have a table it's called loadsurvey which having some duplicate records. I would like to implement unique constraint on my table using following command which should not allow any new duplicate record into table and do not wants to validate existing record.
    ALTER TABLE LOADSURVEY ADD ENABLE NOVALIDATE
    CONSTRAINT LOAD_UNIQUE_CONS UNIQUE (METERNO,DAT,TIM);
    SQL COMMAND WINDOWS SHOWS "ORA-01735: INVALID ALTER TABLE OPTION"
    Any help me to come out the problem.
    Regards,
    Saravanan.

    The syntax is
    alter table .... add constraint ... (<column>) enable novalidate;
    Please try to avoid using all uppercase for the subject line.
    You don't need to shout.
    Sybrand Bakker
    Senior Oracle DBA

  • Problem arises adding unique constraint

    Dear all
    The problem I am facing while adding a unique constraint(based on 2 columns) is ,the table has already duplicate records.I am unable to delete those duplicate records as it has several child record table and those child tables are parent of another table.....and so on. I dont want to use ON DELETE CASCADE.any kind of suggestion?

    Hi,
    If you want to delete the duplicates you can but that is upto you.
    You can delete the duplicate rows by disabling all foreign key constraints.
    SQL> ED
    Wrote file afiedt.buf
      1  select constraint_name,constraint_type,STATUS
      2  from user_constraints
      3* where table_name='EMP'
    SQL> /
    CONSTRAINT_NAME                C STATUS
    PK_EMP                         P ENABLED
    FK_DEPTNO                      R ENABLED
    SQL> ALTER TABLE EMP DISABLE CONSTRAINT FK_DEPTNO;
    Table altered.
    SQL> select constraint_name,constraint_type,STATUS
      2  from user_constraints
      3  where table_name='EMP'
      4  ;
    CONSTRAINT_NAME                C STATUS
    PK_EMP                         P ENABLED
    FK_DEPTNO                      R DISABLED-San
    Edited by: san on Feb 24, 2011 1:02 PM

  • Interactive Report Unique Constraint Error

    Hi all,
    I have this error when trying to create an Interactive Report.
    ORA-00001: unique constraint (APEX_040000.WWV_FLOW_WORKSHEET_COLUMNS_UK2) violated
    Unable to create Dynamic Query page.
    I am not enabling Linkage to a single row, and I trid both UNIQUE key and ROW ID. The query runs perfectly on SQL COMMAND page.
    The query I am using is a little bit complex but not so much.
    SELECT wlji.LAST_UPDATE_DATE
    ,wlji.MODE_FLAG
    ,wlji.LAST_UPDATE_DATE
    ,wlji.LAST_UPDATED_BY
    ,wlji.CREATION_DATE
    ,wlji.CREATED_BY
    ,wlji.TRANSACTION_DATE
    ,wlji.FIRST_UNIT_START_DATE
    ,wlji.LAST_UPDATED_BY_NAME
    ,WLJI.CREATED_BY_NAME
    , (select organization_code from mtl_parameters where organization_id = wlji.ORGANIZATION_id) organization
    ,wlji.LOAD_TYPE
    ,wlji.STATUS_TYPE
    ,wlji.LOT_NUMBER
    ,WLJI.JOB_NAME
    ,( select msi.SEGMENT1 from MTL_SYSTEM_ITEMS_B msi where
    msi.inventory_item_id = wlji.PRIMARY_ITEM_ID and msi.ORGANIZATION_ID = wlji.ORGANIZATION_id) item
    ,wlji.START_QUANTITY
    ,wlji.SCHEDULING_METHOD
    ,wlji.ALLOW_EXPLOSION
    ,wlji.HEADER_ID
    ,wlji.WIP_SUPPLY_TYPE
    ,wlji.process_status
    ,wlji.GROUP_ID
    ,wlji.ATTRIBUTE11 ORIG_PARENT_ID
    ,wlji.ATTRIBUTE12 SEQUENCE_ID
    ,WLJI.ATTRIBUTE13 PREVIOUS_SEQUENCE_ID
    ,WLJI.error_msg || apps.MISWSM_SERUS_INBOUND_IFACE.get_tm_errors(OSFMLOG.TRX_TYPE,OSFMLOG.header_id) error_message
    FROM MISWIP.MISOSFM_INT_TRANSACTIONS_LOG OSFMLOG,WSM_LOT_JOB_INTERFACE wlji,WSM_INTERFACE_ERRORS wie
    WHERE OSFMLOG.STATUS IN ('E','F')
    AND OSFMLOG.TRX_TYPE ='LOT_JOB_CREATE'
    AND NOT EXISTS (SELECT 1 FROM MISWIP.MISOSFM_INT_TRANSACTIONS_LOG OSFMLOG2 WHERE
    OSFMLOG.PARENT_ID= OSFMLOG2.PARENT_ID
    AND OSFMLOG.SEQUENCE_ID = OSFMLOG2.SEQUENCE_ID
    AND NVL(OSFMLOG.PREVIOUS_SEQUENCE_ID,-1) = NVL(OSFMLOG2.PREVIOUS_SEQUENCE_ID,-1)
    AND OSFMLOG2.STATUS ='S')
    AND OSFMLOG.HEADER_ID = WLJI.HEADER_ID
    and WLJI.HEADER_ID = WIE.HEADER_ID(+)
    ORDER BY WLJI.ATTRIBUTE11,WLJI.ATTRIBUTE12,WLJI.ATTRIBUTE13;
    Why can't IR handle this joins?

    SELECT wlji.LAST_UPDATE_DATE
    ,wlji.MODE_FLAG
    ,wlji.LAST_UPDATE_DATEYou have wlji.LAST_UPDATE_DATE twice. No problem, but give the 2nd one a column alias.

  • Programatically detecting uniqueness constraint violations when using Direct Path API

    I'm developing an application that bulk loads data into the
    database using the DirectPath API.
    According to the DirectPath API documentation uniqueness
    constraints must be disabled prior to importing data using the
    DirectPath API, then the constraints must be re-enabled.
    If duplicate data is inserted when the constraints are disabled,
    enabling the constraints results in the constraint's underlying
    index being left in an "unusable" state.
    The SQL*Loader tool (which also uses the DirectPath API) somehow
    manages to deal with this.
    It can successfully detect which data causes the constraint
    violation, and politely writes the offending data to a bad rows
    file.
    If SQL*Loader also uses the DirectPath API - how does it detect
    which data causes a constraint violation.
    The mere fact that SQL*Loader can do this in DirectPath mode,
    shows that it is possible.
    Any ideas how to detect which data causes a constraint violation
    when using the DirectPath API ?
    - Andy

    I'm developing an application that bulk loads data into the
    database using the DirectPath API.
    According to the DirectPath API documentation uniqueness
    constraints must be disabled prior to importing data using the
    DirectPath API, then the constraints must be re-enabled.
    If duplicate data is inserted when the constraints are disabled,
    enabling the constraints results in the constraint's underlying
    index being left in an "unusable" state.
    The SQL*Loader tool (which also uses the DirectPath API) somehow
    manages to deal with this.
    It can successfully detect which data causes the constraint
    violation, and politely writes the offending data to a bad rows
    file.
    If SQL*Loader also uses the DirectPath API - how does it detect
    which data causes a constraint violation.
    The mere fact that SQL*Loader can do this in DirectPath mode,
    shows that it is possible.
    Any ideas how to detect which data causes a constraint violation
    when using the DirectPath API ?
    - Andy

  • Speeding up enable of constraints

    I have various constraints that used to take seconds and now are taking up to half an hr to enable. The data in the tables is static, it has increased or decreased. Does anyone know how to speed up the enabling of constraints on a table? What goes on behind the scenes after issuing alter table <table_name> enable constraint <constraint_name>;
    Thankis

    Dear HouseofHunger,
    Please tell me if that online documentation is enough for you or not?
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/statements_3001.htm#i2183600
    +"+
    +Restrictions on Modifying Constraints Modifying constraints is subject to the following restrictions:+
    +*You cannot change the state of a NOT DEFERRABLE constraint to INITIALLY DEFERRED.+
    +*If you specify this clause for an index-organized table, then you cannot specify any other clauses in the same statement.+
    +*You cannot change the NOT NULL constraint on a foreign key column of a reference-partitioned table, and you cannot change the state of a partitioning referential constraint of a reference-partitioned table.+
    +See Also:+
    +"*Changing the State of a Constraint: Examples*"+
    +"+
    +"+
    +Changing the State of a Constraint: Examples The following statement places in ENABLE VALIDATE state an integrity constraint named emp_manager_fk in the employees table:+
    +ALTER TABLE employees+
    +ENABLE VALIDATE CONSTRAINT emp_manager_fk+
    +EXCEPTIONS INTO exceptions;+
    +Each row of the employees table must satisfy the constraint for Oracle Database to enable the constraint. If any row violates the constraint, then the constraint remains disabled. The database lists any exceptions in the table exceptions. You can also identify the exceptions in the employees table with the following statement:+
    +SELECT e.*+
    +FROM employees e, exceptions ex+
    +WHERE e.rowid = ex.row_id+
    +AND ex.table_name = 'EMPLOYEES'+
    +AND ex.constraint = 'EMP_MANAGER_FK';+
    +The following statement tries to place in ENABLE NOVALIDATE state two constraints on the employees table:+
    +ALTER TABLE employees+
    +ENABLE NOVALIDATE PRIMARY KEY+
    +ENABLE NOVALIDATE CONSTRAINT emp_last_name_nn;+
    +This statement has two ENABLE clauses:+
    +*The first places a primary key constraint on the table in ENABLE NOVALIDATE state.+
    +*The second places the constraint named emp_last_name_nn in ENABLE NOVALIDATE state.+
    +In this case, Oracle Database enables the constraints only if both are satisfied by each row in the table. If any row violates either constraint, then the database returns an error and both constraints remain disabled.+
    +Consider the foreign key constraint on the location_id column of the departments table, which references the primary key of the locations table. The following statement disables the primary key of the locations table:+
    +ALTER TABLE locations+
    +MODIFY PRIMARY KEY DISABLE CASCADE;+
    +The unique key in the locations table is referenced by the foreign key in the departments table, so you must specify CASCADE to disable the primary key. This clause disables the foreign key as well.+
    +"+
    Hope That Helps.
    Ogan

Maybe you are looking for

  • Linux on Intel vs AMD

    Gurus, Have a question regarding running 64 bit oracle on intel vs amd (RHEL). We are currently running on AMD and have been happy. We are seeing a hardware switch away from amd in my co. Does anyone know if the performance of the Xeon 64bit oracle i

  • Can you install 9iDB  on solaris for Intel

    If yes, where can i get 9i for solaris-Intel (or do i use the one for Sun-sparc). Thanks

  • Media Tracker**not able to load image ....Just breaking my head!

    Hello all I am using Media Tracker to diplay or load the image form a source file... but it is not loading...... Any Help appreicate it,.... thanks This is mycode DemoFrame Class: import javax.swing.*; import java.awt.*; import java.awt.geom.*; publi

  • Table maintenence Generator

    HI,   I created table maintenence for a table, when I use sm30 for new entry and when i save the record it is asking transport request every time new record inserted pls suggest thanks in advance karthik

  • IPad safari page load hang

    ok folks.  Long time listener, first time caller.  I've been using the forums for years to research and occasionally even solve ( ;-) ) problems with various and sundry things apple.  My turn. I have an iPad mini I got as a birthday present in 2013 (