ORA-00001 UK Violation

I've had more problems with 2.0 than it's getting to be worth.
Now I'm getting the ORA-00001 UK Violation when attempting to insert a 3 digit entry. Didn't have that problem from 01 to 99. Trying to enter 100 or anything above causes this. It doesn't matter that this 3 digit entry has never been entered before, matter of fact I've tried 10 or 20 different 3 digit codes and they all allegedy violate the unique key constraint. Yes the table will take varchar to 4 digits as well as the field on the form will take 4 digits.
WTF is going on NOW? I'm really starting to get fed up with this release. It looks nice 'n "pretty" and I've only found a smattering of what's broken in it.
The UK is being used to link another table to ensure only valid 3 digit entries are made into the other table.
This must be my fault... or is it?

I guess I need to apologize for ranting in the forum rather than just pose questions. Sorry to all.
For a non programmer like myself, I have to rely heavily on the application to create the proper code for me. I have limited knowledge about the more complicated PL/SQL features. So for me, point & click code generation is sorely needed. When switching from 1.6 to 2.0 it was like having to learn an entirely new application all over again as it appeared the code for certain things was generated differently. Also, things that were working in 1.6 that now have to be re-engineered are a major source of frustration on my end.
Anyhow, Earl thanks for looking in, here's the table in question:
CREATE TABLE "POD_INV"
(     "AUTOID" NUMBER(38,0) NOT NULL ENABLE,
     "POD_NUM" VARCHAR2(4) NOT NULL ENABLE,
     "POD_SER" VARCHAR2(36),
     "POD_MOD" VARCHAR2(36),
     "CAM_SER" VARCHAR2(36),
     "CAM_MOD" VARCHAR2(36),
     "HD_MOD" VARCHAR2(36),
     "HD_SER" VARCHAR2(36),
     "TX_SER" VARCHAR2(36),
     "TX_MOD" VARCHAR2(36),
     "GENERATION" VARCHAR2(4) NOT NULL ENABLE,
     "WIRELESS" VARCHAR2(1) NOT NULL ENABLE,
     "OWNER" VARCHAR2(36) NOT NULL ENABLE,
     "USER_ID" VARCHAR2(8),
     "RECORD_DATE" DATE NOT NULL ENABLE,
     "UPDATE_DATE" DATE,
     "TEMP1" VARCHAR2(36),
     "TEMP2" VARCHAR2(36),
     "TEMP3" NUMBER(38,0),
     CONSTRAINT "POD_INV_PK" PRIMARY KEY ("AUTOID") ENABLE,
     CONSTRAINT "POD_INV_UK" UNIQUE ("POD_NUM") ENABLE
CREATE OR REPLACE TRIGGER "BI_POD_INV"
before insert on "POD_INV"
for each row
begin
select "POD_INV_SEQ".nextval into :NEW.AUTOID from dual;
end;
ALTER TRIGGER "BI_POD_INV" ENABLE
All point & click generated and unchanged. I had no problem with this table or entering data until the POD_NUM went above 99. Once I hit 100 the problems started. What doesn't make sense to me is that I thought UNIQUE key constraint only checked for repeat values. I've tried many values that were never entered, since I'm the only one entering data at this point, and yet the constraint is still stopping me. Question would be how could a unique key constraint trigger on a unique value when the data to enter hits 3 digits or more?
Thanks Earl or anyone that can help

Similar Messages

  • ORA-00001 contraint violation

    Hi all,
    I'm trying to do an insertion of values on 2 tables. My SQL script is the following :
    insert into ASSOCIATE (ID,SALUTATIONID,LASTNAME, FIRSTNAME,IS_EXTERNAL,LOGIN, PASSWD,ROLEID, ADDRESSID, BOSSID,DEPARTMENT, SITEID)
    SELECT associate_spe_seq.NEXTVAL,'4','FOXTROT','-','Y','','','2','','','','4'
    FROM DUAL;
    insert into ASSOCIATE_SPECIALTY (ASSOCIATE_ID, SPECIALTY_ID) VALUES (associate_spe_seq.CURRVAL, '2');
    In output I have this error :_
    1 rows inserted
    NEXTVAL '4' 'FOXTROT' '-' 'Y' ''
    1 rows selected
    Error starting at line 4 in command:
    insert into ASSOCIATE_SPECIALTY (ASSOCIATE_ID, SPECIALTY_ID) VALUES (associate_spe_seq.CURRVAL, '2')
    Error report:
    SQL Error: ORA-00001: unique violation contraints (PK_ASSOCIATE_SPECIALTY)
    00001. 00000 - "unique constraint (%s.%s) violated"
    *Cause:    An UPDATE or INSERT statement attempted to insert a duplicate key.
    For Trusted Oracle configured in DBMS MAC mode, you may see
    this message if a duplicate entry exists at a different level.
    *Action:   Either remove the unique restriction or do not insert the key.
    1 rows inserted
    1 rows inserted
    Do you know how can I solved this problem ?
    Thanks,
    Jarod.

    Hi, Jarod,
    The "INSERT INTO associate_specialty" statement is trying to add a key that is supposed to be unique, but already exists in the table.
    First, make sure which column(s) are involved:
    SELECT  column_name
    FROM    all_constraints
    WHERE   constraint_name = 'PK_ASSOCIATE_SPECIALTY'  -- Exactly as in the error message, including capitalization
    ;The full error message tells what to do: "Either remove the unique restriction or do not insert the key."
    Given that you already have a row with that key value, do you need to add another row with the same key value? If so, then the unique constraint is wrong, and you should drop the constraint.
    If the key really needs to be unique, the problem could be several things.
    One is that you just didn't realize the row had already been added, and you don;t have to add another one.
    Another is that you're relying on the sequence to give you unused values, but some of the values being generated by the sequence are already in the table. If that's the case, you should find the largest value already in the table, and genereate new sequence numbers (that you don't use for anything), until the sequence is past that point.

  • ORA: 00001 error when issued commit_form

    I have a question about finalizing the changes when using commit_form.
    There is a database trigger on the table which records all the changes update, insert, delete into an audit table. The actual sequence of actions going on in the form are
    1. Update a row in a table (No explicit update stmt is issued as the block is a database block)
    2. Key-Commit(issues commit_form)
    3. Delete the same row which was previously updated (happens thru explicit delete stmt in the Post-Forms-Commit/Post-Database-Commit
    4. forms_ddl(commit_form)
    Actions 1 & 2 are working fine. Action 3 is throwing an error ORA: 00001. And if the trigger is disabled then the form is working fine.
    I wanna know if the forms issues a commit_form, will it finalizes the changes in the database or will it waits for the post-forms-commit trigger to get completed and then finalizes the changes.
    Can anyone help me with this?
    Thanks for your time

    Here is the help on Post-Database-Commit Trigger:
    Fires once during the Post and Commit Transactions process, after the database commit occurs. Note that the Post-Forms-Commit trigger fires after inserts, updates, and deletes have been posted to the database, but before the transaction has been finalized by issuing the Commit.
    I think you are fine at this point, as long as you use changed values in the WHERE clause of your DELETE statement.
    ORA: 00001 is violation of UNIQUE CONSTRAINT, which really does not make any sense in context of DELETE statement, because you are not adding a new record but deleting one (Step 3).
    With limited info I have here, I think that you are running into constraint issues on your audit table, because update and delete are happening almost at the same time, and you will be effectively getting two records in your audit table, that depending how UNIQUE constraints are setup on your audit table might cause the issue.
    By the way it boggles my mind: why would you change and delete record from the table at the same time?

  • ORA-00001 - unique constraint violation when upgrading 10g EUL

    Hi,
    I am trying to upgrade my Discoverer 4i to Discoverer 10g.
    When I log into 10g, it prompts me to upgrade the EUL. After making the right back up of my 4i EUL, I continue with the upgrade.
    During the upgrade, I am hit with this error:
    Database error: ORA-00001 unique constraint (EUL_HRMS.EUL5_FOL_UK_1) violated.
    I understand that this happens when user tries to insert an already existing value into a column defined as unique. However, I am not sure on how to resolve it.
    Can anyone please advice.
    Thanks in advance!
    Regards,
    Harpreet Sidhu

    Hi Rod,
    I've run the queries and these are the results. Each query returned one row.
    1. SELECT FROM EUL_HRMS.EUL5_DOC_FOLDERS*
    FOL_ID     100057
    FOL_NAME     ROOT
    FOL_DEVELOPER_KEY     ROOT
    FOL_DESCRIPTION     
    FOL_EU_ID     100000
    FOL_PARENT_ID     
    FOL_USER_PROP2     
    FOL_USER_PROP1     
    FOL_ELEMENT_STATE     0
    FOL_CREATED_BY     EUL_HRMS
    FOL_CREATED_DATE     19-Jun-09
    FOL_UPDATED_BY     EUL_HRMS
    FOL_UPDATED_DATE     19-Jun-09
    NOTM     0
    2. SELECT EU_ID, EU_SECURITY_MODEL, EU_USE_PUB_PRIVS, EU_ROLE_FLAG
    FROM EUL_HRMS.EUL5_EUL_USERS
    WHERE EU_USERNAME = 'PUBLIC'
    EU_ID     3000
    EU_SECURITY_MODEL     0
    EU_USE_PUB_PRIVS     1
    EU_ROLE_FLAG     0
    Thanks!

  • (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

  • ORA-00001 uniqueness error yet no apparent violation in the data

    I have a simple insert statement that generates an ORA-00001 error on the primary key. There are no other unique constraints on the table. The SQL statement is basic:
    insert into X
    query;
    Fortunately, the result set is small enough that I can just examine it brute force. But, when I run the query alone, the result set does not reveal any obvious uniqueness errors. (And yes, I've checked to see if the data is in the table before I ran the insert).
    So, I converted the insert statement to a PL/SQL block with a cursor loop:
    declare
    cursor cX is query;
    for rec in cX loop
    insert into X values (rec.values);
    end loop;
    exception
    when others output sqlerrm
    end;
    Yet, when I run this cursor loop, there is no exception raised! (and all the data inserts successfully with no errors).
    So, I suppose I should be satisfied that the cursor loop works, yet it disturbs me that this "nonexistent" uniqueness error occurred to begin with.
    Any idea why this could be happening?
    Thanx in advance.

    I'm actually writing to a log table in the exception handler, so server output is not an issue.
    Ok, here's the insert statement. The line numbers skip as I removed the column mappings for the table. The primary key for agg_daily_sales is (invoice_dt, company_cd, branch_nbr, ordr_nbr, dist_nbr, ship_nbr, ordr_dt).
    12:30:00 SQL> insert into ods.agg_daily_sales
    12:30:24 52 select inv.invoice_dt
    12:30:24 53 , os.company_cd
    12:30:24 54 , os.branch_nbr
    12:30:24 55 , os.ordr_nbr
    12:30:24 56 , os.dist_nbr
    12:30:24 57 , os.ship_nbr
    12:30:24 58 , ol.line_nbr
    12:30:24 59 , os.ordr_dt
    12:30:24 60 , inv.invoice_nbr
    12:30:24 61 , o.cust_ordr_nbr
    12:30:24 62 , o.bill_to_branch_nbr
    12:30:24 63 , o.bill_to_cust_nbr
    12:30:24 64 , os.branch_nbr_ship_from
    12:30:24 65 , o.is_slsmn
    12:30:24 66 , o.os_slsmn
    12:30:25 67 , trim(inshed.inv_part_nbr)
    12:30:25 68 , inshed.vendor_nbr
    12:30:25 69 , inshed.seq_nbr
    12:30:25 70 , inshed.vendor_part_nbr
    12:30:25 71 , ol.unit_prc
    12:30:25 72 , ol.unit_prc * ccy.USD_per_unit
    12:30:25 73 , ol.unit_cost
    12:30:25 74 , ol.unit_cost * ccy.USD_per_unit
    12:30:25 75 , ol.adj_cost
    12:30:25 76 , ol.adj_cost * ccy.USD_per_unit
    12:30:25 77 , ol.qty_shpd
    12:30:25 78 , ol.qty_orded
    12:30:25 79 , ol.qty_bild
    12:30:25 80 , ol.qty_bord
    12:30:25 81 , o.ccy_cd
    12:30:25 82 , ccy.usd_per_unit
    12:30:25 83 , ol.qty_shpd * ol.unit_prc
    12:30:25 84 , ol.qty_shpd * ol.unit_cost
    12:30:26 85 , ol.qty_shpd * ol.adj_cost
    12:30:26 86 , ol.qty_shpd * (ol.unit_prc - ol.unit_cost)
    12:30:26 87 , ol.qty_shpd * (ol.unit_prc - ol.adj_cost)
    12:30:26 88 , case when (ol.qty_shpd * ol.unit_prc) = 0 then 0
    12:30:26 89 when (ol.qty_shpd * ol.unit_prc) < 1 then 100
    12:30:26 90 else ( (ol.unit_prc - ol.unit_cost) / ol.unit_prc ) * 100
    12:30:26 91 end
    12:30:26 92 , case when (ol.qty_shpd * ol.unit_prc) = 0 then 0
    12:30:26 93 when (ol.qty_shpd * ol.unit_prc) < 1 then 100
    12:30:26 94 else ( (ol.unit_prc - ol.adj_cost) / ol.unit_prc ) * 100
    12:30:26 95 end
    12:30:26 96 , ol.qty_shpd * ccy.USD_per_unit * ol.unit_prc
    12:30:26 97 , ol.qty_shpd * ccy.USD_per_unit * ol.unit_cost
    12:30:26 98 , ol.qty_shpd * ccy.USD_per_unit * ol.adj_cost
    12:30:27 99 , ol.qty_shpd * ccy.USD_per_unit * (ol.unit_prc - ol.unit_cost)
    12:30:27 100 , ol.qty_shpd * ccy.USD_per_unit * (ol.unit_prc - ol.adj_cost)
    12:30:27 101 , case when (ol.qty_shpd * ol.unit_prc) = 0 then 0
    12:30:27 102 when (ol.qty_shpd * ol.unit_prc) < 1 then 100
    12:30:27 103 else ( (ol.unit_prc - ol.unit_cost) / ol.unit_prc ) * 100
    12:30:27 104 end
    12:30:27 105 , case when (ol.qty_shpd * ol.unit_prc) = 0 then 0
    12:30:27 106 when (ol.qty_shpd * ol.unit_prc) < 1 then 100
    12:30:27 107 else ( (ol.unit_prc - ol.adj_cost) / ol.unit_prc ) * 100
    12:30:27 108 end
    12:30:27 109 , ol.frt_in_amt_bild
    12:30:27 110 , ol.frt_out_amt_bild
    12:30:28 111 , ol.pc_tax_amt
    12:30:28 112 , sysdate
    12:30:28 113 from ods.ods_order_invoice_nbr inv
    12:30:28 114 , ods.ods_order o
    12:30:28 115 , ods.ods_order_shipment os
    12:30:28 116 , ods.ods_order_line ol
    12:31:13 117 , ods.ods_currency_rate ccy
    12:31:13 118 , (select distinct
    12:31:13 119 inshed2.company
    12:31:13 120 , hpx.vendor_nbr
    12:31:13 121 , inshed2.inv_part_nbr
    12:31:13 122 , inshed2.seq_nbr
    12:31:13 123 , inshed2.vendor_part_nbr
    12:31:13 124 from ods.hierarchy_product_xref hpx
    12:31:13 125 , ods.ref_company co2
    12:31:13 126 , ods.ims_prod_inshed inshed2
    12:31:13 127 where co2.business_region = 'EU'
    12:31:13 128 and hpx.hierarchy_ID = 1
    12:31:13 129 and hpx.company_cd = co2.company_cd
    12:31:13 130 and hpx.company_cd = inshed2.company
    12:31:13 131 and hpx.IM_part_nbr = inshed2.inv_part_nbr
    12:31:13 132 ) inshed
    12:31:13 133 where
    insert into ods.agg_daily_sales
    ERROR at line 1:
    ORA-00001: unique constraint (ODS.AGG_DAILY_SALES_PK) violated
    Elapsed: 00:09:16.01
    12:40:32 SQL>

  • Regarding ORA-00001: unique constraint violation error

    Hi ,
    This is Venkat. I am new to OWB.
    When I run the mapping I am getting the ORA-00001: unique constraint violation error.
    My loading type is Update/Insert.
    My target table Primarykey is combination of 3 keys.
    Please give me the suggestions. It is very urgent.
    Thanks,
    Venkat

    1) If you can disable/drop the indexes on the table, you can load the data and then do a SQL query grouping by the PK/UI to show which rows have a count > 1 i.e. the duplicates.
    2) If you can't alter the target table, perhaps create a dummy copy of the table without pk/indexes and load to that and then do above query.
    3) Run the mapping via the debugger and set a breakpoint just before your target table and examine the data to see if you can spot the duplicates.
    4) Put a deduplicator into the mapping (just before target table), this may allow you to load data but doesn't solve the real problem as to why you have duplicates.
    Si

  • ORA-00001 unique constraint violation updating row

    Hi Folks,
    Using oracle application express version 3.1.2.00.02 to update one column in a table ORA-00001: unique constaint (BI_ADS.FCV_UK) violated error is returned. This is strange as the column being updated has no constraint on it.
    We have had a trace done on the database action and it is a normal UPDATE statement.
    You can run this UPDATE statement directly against the database with no errors.
    When using APEX the error is returned.
    Some rows update OK and a few rows will not.
    There are no sequences involved.
    Thanks
    Brian

    It turns out the form is stripping the time off the date column (constraint column) and this is causing the unique contraint violation. Any one had any dealings with times not being updated with a date column from a form??

  • Error while adding Image: ORA-00001: unique constraint

    Dear all,
    I have an error while adding images to MDM I can´t explain. I want to add 7231 images. About 6983 run fine. The rest throws this error.
    Error: Service 'SRM_MDM_CATALOG', Schema 'SRMMDMCATALOG2_m000', ERROR CODE=1 ||| ORA-00001: unique constraint (SRMMDMCATALOG2_M000.IDATA_6_DATAID) violated
    Last CMD: INSERT INTO A2i_Data_6 (PermanentId, DataId, DataGroupId, Description_L3, CodeName, Name_L3) VALUES (:1, :2, :3, :4, :5, :6)
    Name=PermanentId; Type=9; Value=1641157; ArraySize=0; NullInd=0;
    Name=DataId; Type=5; Value=426458; ArraySize=0; NullInd=0;
    Name=DataGroupId; Type=4; Value=9; ArraySize=0; NullInd=0;
    Name=Description_L3; Type=2; Value=; ArraySize=0; NullInd=0;
    Name=CodeName; Type=2; Value=207603_Img8078_gif; ArraySize=0; NullInd=0;
    Name=Name_L3; Type=2; Value=207603_Img8078.gif; ArraySize=0; NullInd=0;
    Error: Service 'SRM_MDM_CATALOG', Schema 'SRMMDMCATALOG2_m000', ERROR CODE=1 ||| ORA-00001: unique constraint (SRMMDMCATALOG2_M000.IDATA_6_DATAID) violated
    Last CMD: INSERT INTO A2i_Data_6 (PermanentId, DataId, DataGroupId, Description_L3, CodeName, Name_L3) VALUES (:1, :2, :3, :4, :5, :6)
    Name=PermanentId; Type=9; Value=1641157; ArraySize=0; NullInd=0;
    Name=DataId; Type=5; Value=426458; ArraySize=0; NullInd=0;
    Name=DataGroupId; Type=4; Value=9; ArraySize=0; NullInd=0;
    Name=Description_L3; Type=2; Value=; ArraySize=0; NullInd=0;
    Name=CodeName; Type=2; Value=207603_Img8085_gif; ArraySize=0; NullInd=0;
    Name=Name_L3; Type=2; Value=207603_Img8085.gif; ArraySize=0; NullInd=0;
    I checked all data. There is no such dataset in the database. Can anybody give me a hint how to avoid this error.
    One thing I wonder: The PermanentId is allways the same but I can´t do anything here.
    BR
    Roman
    Edited by: Roman Becker on Jan 13, 2009 12:59 AM

    Hi Ritam,
    For such issues, can you please create a new thread or directly email the author rather than dragging back up a very old thread, it is unlikely that the resolution would be the same as the database/application/etc releases would most probably be very different.
    For now I will close this thread as unanswered.
    SAP SRM Moderators.

  • 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

  • ORA-00001: unique constraint (REMEDY.SYS_C001727

    Hi: I have a simple table with a primary key (ENTRYID). All other fields are just fields with no constraints. When I try to insert records, for some records I get the above error. The table does not already have this record.
    INSERT INTO REMEDY.VITALEXCEPTION (ENTRYID, CUSTID, DEVICENAME, INTERFACE, EXCEPTION, DURATION, TIME)
    VALUES ('jvis2rspm01.S0/0/0_FMS:65999591 NA:3836400887 TERM:cmny83bbf/20351BDU1182798445', 'fxms', 'jvis2rspm01', 'S0/0/0_FMS:65999591 NA:3836400887 TERM:cmny83bbf/20351', 'BDU', 5476, 1182792934);
    INSERT INTO REMEDY.VITALEXCEPTION (ENTRYID, CUSTID, DEVICENAME, INTERFACE, EXCEPTION, DURATION, TIME)
    ERROR at line 1:
    ORA-00001: unique constraint (REMEDY.SYS_C001727) violated
    Could someone help.
    Thanks
    Ray

    hi,
    can you post the table structure?
    I suspect that ENTRYID has lesser length than the actual value and in effect the value has been truncated for some reason.
    The primary key value is too long, maybe creating a surrogate key would help.
    J

  • ORA-00001 - Unique Constraint on R5TRANSLINES

    Hello,
    I get the following error when i am inserting into R5TRANSLINES "2009-06-23 14:44:51,698 DEBUG [com.dstm.mp.MPDBException] **!!Error Code:|1|, Msg:|ORA-00001: unique constraint (REMPLOY.R5PRIK_TRL) violated"
    I have a flex trigger in the system which is envoked when inserting parts into my warehouse:
    Declare
    cursor c_palletparts( pallet varchar2) is
    select obj_part from r5objects
    where
    obj_parent = pallet;
    v_pallet varchar2(255);
    v_evtcode varchar2(255);
    v_transcode varchar2(255);
    v_line number :=0;
    v_store varchar2(255);
    v_trltype varchar2(4);
    v_trlrtype varchar2(4);
    v_trlio number;
    v_bin VARCHAR2(15);
    v_binin VARCHAR2(15);
    ncounter number;
    cur_message varchar2(200);
    begin
    select trl_part, trl_trans, trl_line into v_pallet, v_transcode, v_line from r5translines
    where rowid = :rowid;
    select count(*) into ncounter from r5objects where obj_code = v_pallet and obj_class = 'PALLET';
    if ncounter = 1 then
    select trl_part, trl_trans, trl_line, trl_store, trl_type, trl_rtype, trl_io, trl_bin into v_pallet, v_transcode, v_line, v_store, v_trltype, v_trlrtype, v_trlio, v_binin
    from r5translines
    where trl_trans = v_transcode
    and trl_line = v_line;
    IF v_trlrtype = 'RECV' THEN
    update r5objects set obj_store = v_store where obj_code = v_pallet;
    UPDATE R5PROPERTYVALUES SET PRV_VALUE = v_store WHERE prv_code = v_pallet||'#*' AND PRV_PROPERTY = 'RMP231' AND PRV_RENTITY = 'OBJ';
    END IF;
    -- update r5parts set par_byasset = '+' where par_code = v_pallet;
    for r_palletparts in c_palletparts(v_pallet) loop
    IF v_trlrtype = 'I' then
    select count(*) into ncounter from r5stock
    where sto_part = r_palletparts.obj_part
    and sto_store = v_store
    and sto_part_org = '*';
    IF ncounter = 0 then
    INSERT INTO R5STOCK (STO_PART, STO_STORE, STO_STOCKTAKE, STO_QTY, STO_CONSIGNMENT, STO_PART_ORG, STO_PRICETYPE, STO_ONDEMAND, STO_REPAIRQTY, STO_VENDORQTY, STO_SHOPQTY, STO_REPAIRTYPE, STO_REPSTOCKMETHOD, STO_REPAUTOASSIGN, STO_LABELDEFAULT)
    VALUES (r_palletparts.obj_part, v_store, SYSDATE, 1, '-', '*', 'A', '-', 0, 0, 0, '-', '-', '-', 0);
    END IF;
    select count(*) into ncounter from r5binstock
    where bis_part = r_palletparts.obj_part
    and bis_store = v_store
    and bis_part_org = '*';
    IF ncounter = 0 then
    INSERT INTO R5BINSTOCK(BIS_PART, BIS_STORE, BIS_BIN, BIS_LOT, BIS_QTY, BIS_PART_ORG, BIS_REPAIRQTY)
    VALUES (r_palletparts.obj_part, v_store, '*', '*', 1, '*', 0);
    END IF;
    select min(bis_bin) into v_bin from r5binstock
    where bis_part = r_palletparts.obj_part
    and bis_store = v_store
    and bis_part_org = '*';
    update r5binstock set bis_qty = 1 where bis_part = r_palletparts.obj_part
    and bis_store = v_store
    and bis_bin = v_bin;
    else
    update r5objects set obj_store = v_store where obj_code = r_palletparts.obj_part;
    -- UPDATE R5PROPERTYVALUES SET PRV_VALUE = v_store WHERE prv_code = r_palletparts.obj_part||'#*' AND PRV_PROPERTY = 'RMP231' AND PRV_RENTITY = 'OBJ';
    IF r_palletparts.obj_part NOT IN ('X') THEN
    cur_message := r_palletparts.obj_part||'|'||v_trltype||'|'||v_store||'|'||ncounter;
    -- raise_application_error(-20000,cur_message);
    END IF;
    v_bin := v_binin;
    end if;
    v_line := v_line + 1;
    insert into r5translines
    (trl_trans,trl_type, trl_rtype, trl_line, trl_date,
    trl_part, trl_lot, trl_bin, trl_store, trl_price,
    trl_qty, trl_io, trl_part_org)
    values
    (v_transcode, v_trltype, v_trlrtype, v_line, sysdate,
    r_palletparts.obj_part, '*', v_bin, v_store, 0,
    1, v_trlio, '*' );
    end loop;
    end if;
    Exception
    when no_data_found then
    Null;
    end;
    Can someone please tell me how to make this key unique.
    Many Thanks
    Chris

    Hi,
    You can create rule for truncate using below:
    BEGIN
    DBMS_RULE_ADM.CREATE_RULE(
    rule_name => 'TRUNCATE_RULE',
    condition => '(:ddl.get_object_owner() = ''HR'' AND ' ||
    ':ddl.get_object_name() = ''TEST'') AND ' ||
    ':ddl.get_command_type() = ''TRUNCATE TABLE'' ');
    END;
    Thanks,
    Reena

  • ORA-00001:Unique Constraint while inserting 2 similar records from source

    Hi,
    in TEST1 there are records:
    10 20 ABC
    10 20 DEF
    I amt trying to insert into TEST which has CODE as Primary Key.
    declare
    type cur is ref cursor;
    cur_t cur;
    type v_t is table of TEST%rowtype;
    tab v_t;
    v_act_cnt_str VARCHAR2(4000);
    v_act_cnt NUMBER:=0;
    BEGIN
    v_act_cnt_str:=' SELECT COUNT(*) '||' FROM TEST '||' WHERE '||'('||CODE||')'||' IN '||'('||'SELECT '||CODE||' FROM TEST1'||')';
    DBMS_OUTPUT.PUT_LINE('The Actual Count String is'||v_act_cnt_str);
    EXECUTE IMMEDIATE v_act_cnt_str INTO v_act_cnt;
    open cur_t for select * from TEST1 ORDER BY ROWNUM;
    loop
    fetch cur_t bulk collect into tab limit 10000;
    if v_act_cnt=0 THEN
    forall i in 1..tab.count
    insert into TEST values tab(i);
    commit;
    ELSE
    v_merge_act_str :=
    'MERGE INTO TEST '||
    ' DEST' || ' USING TEST1 '||
    ' SRC' || ' ON (' || DEST.CODE=SRC.CODE || ')' ||
    ' WHEN MATCHED THEN ';
    first_str := 'UPDATE ' || ' SET ' ||
    'DEST.NAME=SRC.NAME,DEST.DEPT_NAME=SRC.DEPT_NAME;
    execute immediate v_merge_act_str || first_str;
    v_merge_act_str := '';
    first_str := '';
    commit;
    END IF;
    end loop;
    END;
    ITS GIVING ERROR as:
    ORA-00001: unique constraint (PK_TEST1) violated
    Any help will be needful for me
    Edited by: user598986 on Sep 22, 2009 4:20 AM
    Edited by: user598986 on Sep 22, 2009 4:22 AM

    Your code makes absolutely no sense whatsover. The whole point of MERGE is that it allows us to conditionally apply records from a source table as inserts or updates to a target table. So why have you coded two separate statements? And why are you using such horrible dynamic SQL?
    Sorry to unload on you, but you seem to have your code unnecessarily complicated, and that it turn makes it unnecessarily harder to debug. As an added "bonus" this approach will also perform considerably slower than a single MERGE statement. SQL is all about set operations. Don't do anything procedurally which can be done in a set.
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • ORA-00001 UNIQUE CONSTRAINT ERROR ON SYS.WRH$_SQLTEXT_PK?

    /u01/app/oracle/admin/bill02/bdump/bill02_m000_10074.trc
    Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    ORACLE_HOME = /u01/app/oracle/product/10.1.0
    System name: SunOS
    Node name: bill02
    Release: 5.9
    Version: Generic_117171-17
    Machine: sun4u
    Instance name: bill02
    Redo thread mounted by this instance: 1
    Oracle process number: 55
    Unix process pid: 10074, image: oracle@bill02 (m000)
    *** 2005-10-27 02:03:14.682
    *** ACTION NAME:(Auto-Flush Slave Action) 2005-10-27 02:03:14.667
    *** MODULE NAME:(MMON_SLAVE) 2005-10-27 02:03:14.667
    *** SERVICE NAME:(SYS$BACKGROUND) 2005-10-27 02:03:14.667
    *** SESSION ID:(519.24807) 2005-10-27 02:03:14.667
    *** KEWROCISTMTEXEC - encountered error: (ORA-00001: unique constraint (SYS.WRH$_SQLTEXT_PK) violated
    *** SQLSTR: total-len=570, dump-len=240,
    STR={INSERT INTO wrh$_sqltext                      (sql_id, dbid, sql_text,                       command_type, snap_id, ref_count)      SELECT /*+ ordered use_nl(s1) index(s1) */             sie.sqlid_kewrsie, :dbid, s1.sql_fulltext,           }
    *** KEWRAFM1: Error=13509 encountered by kewrfteh
    How to fix?
    Thanks!

    Have you tried searching Metalink? A unique constraint violation on a SYS table by MMON will almost certainly require Oracle Support's assistance to resolve. Something rather deep inside Oracle has done something wrrong.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

Maybe you are looking for