Unique constraint on an indexed field

I have a table with ALOC and ZLOC fields. They are starting points and destinations, respectively. If you can imagine a circuit, however, they represent the same wire whether the ALOC comes first or the ZLOC. New circuits come in and are inserted with an ALOC and a ZLOC, both 8 characters each. They are not unique individually. But they go in together in a master table that is constrained unique. So far everything is OK. The problem comes when you have an ALOC and ZLOC combination as in the first line below. You cannot enter another one like it. However, according to business and common sense rules, the second line also cannot be entered, because it represents the same wire, just turned around. Only 1 version of what is below can be entered into this 17 character field at a time. If ALOC and ZLOC are the same, of course, it only needs to be checked once as it is the same location and would also be the same if turned around.
GNBONCEU-BURLNCDA
BURLNCDA-GNBONCEU
Does anyone have any hints at how I can work this? Somehow, I have to check if the first version is unique. If it is not, it may be unique the other way around, so I would not enter it into what we call the MASTER field. Of course, if it is unique on the first pass, it won't go in.
Thanks for any ideas.

REVERSE() function will not be helpful in this case.
You should create a mechanism that would do this check before inserting in table.
If the format of input value is hyphen delimited, then you might want to create a function that would break string from hyphen and then reverse them. Then, check in the database if any of the strings (normal or reversed) exists.
A trigger in combination with function will serve your purpose.

Similar Messages

  • Difference between unique constraint and unique index

    1. What is the difference between unique constraint and unique index when unique constraint is always indexed ? Which one is better in this case for better performance ?
    2. Is Composite index of 3 columns x,y,z better
    or having independent/ seperate indexes on 3 columns x,y,z is better for better performance ?
    3. It has been very confusing for me to decide which columns to index, I have indexed most foreignkey columns, is it a good idea ? We do lot of selects and DMLS on most of our tables. Is there any query that I can run and find out if indexes are really being used and if they are improving any performance. I have analyzed and computed my indexes using ANALYZE index index_name validate structure and COMPUTE STATISTICS;
    null

    1. Unique index is part of unique constraint. Of course you can create standalone unique index. But is is no point to skip the logical view of business if you spend same effort to achive.
    You create unique const. Oracle create the unique index for you. You may specify index characteristic in unique constraint.
    2. Depends. You can't utilize the composite index if the searching condition is not whole or front part of the indexing key. You can't utilize your index if you query the table for y=2. That is.
    3. As old words in database arena, Index may be good or bad for a table depending on the size of table, number of columns in the table... etc. It is very environmental dependent. In fact, It is part of database nomalization. Statistic is a way oracle use to determine the execution plan.
    Steve
    null

  • Insert / delete fails on unique constraint (order problem)

    Hi dear Kodo team,
    within a transaction, we are deleting a certain jdo object. The deletion is
    undone later (within the same tx), resulting in creating a new object with
    the same contents as the deleted one (gets another oid, of course). In our
    database, there is a unique constraint on two mapped fields of this object.
    Unfortunately, kodo issues the INSERT statement before the DELETE
    statement, thus producing a unique constraint violation.
    Is there a way to influence the statement order? Is there any solution other
    than disabling / deferring this constraint?
    Thanks in advance,
    Contus

    Beside Oracle, we are using our db schema on db platforms that do not
    support deferred constraints. That's why we would like to know if there is
    a way to influence statement order without removing those constraints.
    Thanks,
    Contus
    Alex Roytman wrote:
    In general the best option is to use deferred constraints on all your FK
    and unique constraints. You still get complete referential integrity but
    do not need Kodo to order your statements for you. If you are already
    doing it but still get this error message and you are using Oracle 9.2 it
    seems to be a bug in oracle JDBC. I submitted it to oracle - they accepted
    it and supposedly working on resolution
    "contus" <[email protected]> wrote in message
    news:bulku6$qad$[email protected]..
    Hi dear Kodo team,
    within a transaction, we are deleting a certain jdo object. The deletionis
    undone later (within the same tx), resulting in creating a new object
    with the same contents as the deleted one (gets another oid, of course).
    In our database, there is a unique constraint on two mapped fields of
    thisobject.
    Unfortunately, kodo issues the INSERT statement before the DELETE
    statement, thus producing a unique constraint violation.
    Is there a way to influence the statement order? Is there any solutionother
    than disabling / deferring this constraint?
    Thanks in advance,
    Contus

  • How define unique constraint on many fields

    Hi,
    is there the possibility in kodo 4.1 to define unique constraint on many
    fields of a persistent class using orm mapping?
    I found the "unique" attribute to define on the field element, but it
    seams that this attribute cannot be define on may fields so that a
    unique combined index can be created.
    Any hint is welcome.
    Thank you very much.
    Daniela

    Unique constraint spanning multiple fields can be specified as follows:
    @Entity
    @Table(name="POBJECT", uniqueConstraints=
    {@UniqueConstraint(columnNames={"FIRST", "LAST"})})
    public class PObject {
    private String first;
    private String last;
    }

  • Difference Between Unique Index vs Unique Constraint

    Can you tell me
    what is the Difference Between Unique Index vs Unique Constraint.
    and
    Difference Between Unique Index and bitmap index.
    Edited by: Nilesh Hole,Pune, India on Aug 22, 2009 10:33 AM

    Nilesh Hole,Pune, India wrote:
    Can you tell me
    what is the Difference Between Unique Index vs Unique Constraint.http://www.jlcomp.demon.co.uk/faq/uk_idx_con.html
    and
    Difference Between Unique Index and bitmap index.The documentation is your friend:
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/schema.htm#CNCPT1157
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/schema.htm#sthref1008
    Regards,
    Rob.

  • Unique Index vs. Unique Constraint

    Hi All,
    I'm studying for the Oracle SQL Expert Certification. At one point in the book, while talking about indices, the author says that a unique index is not the same a unique constraint. However, he doesn't explain why they're two different things.
    Could anyone clarify the difference between the two, please?
    Thanks a lot,
    Valerio

    A constraint has different meaning to an index. It gives the optimiser more information and allows you to have foreign keys on the column, whereas a unique index doesn't.
    eg:
    SQL> create table t1 (col1 number, col2 varchar2(20), constraint t1_uq unique (col1));
    Table created.
    SQL> create table t2 (col1 number, col2 varchar2(20));
    Table created.
    SQL> create unique index t2_idx on t2 (col1);
    Index created.
    SQL> create table t3 (col1 number, col2 number, col3 varchar2(20), constraint t3_fk
      2                   foreign key (col2) references t1 (col1));
    Table created.
    SQL> create table t4 (col1 number, col2 number, col3 varchar2(20), constraint t4_fk
      2                   foreign key (col2) references t2 (col1));
                     foreign key (col2) references t2 (col1))
    ERROR at line 2:
    ORA-02270: no matching unique or primary key for this column-listIt's like saying "What's the difference between a car seat and an armchair? They both allow you to sit down!"

  • Create unique constraint on table

    Hello experts,
    Is it possible to define a unique constraint on table fields that aren't part of the primary key?
    Thank you in advance.

    One way is to create an index on the field and make it unique (SE11->GOTO->Indexes). Then in your programs Inserts, Appends and Updates would fail giving you a non zero SY-SUBRC when a program tries to enter a value that already exists.
    Don't forget to include MANDT in the index otherwise you'll end up with uniqueness across all clients

  • UNIQUE constraint on a varchar column

    I have a (non-key) varchar2 column that I need to be unique. I specify UNIQUE in the table create line like:
    create table tester(
    id number primary key,
    field varchar2(255) UNIQUE
    but it doesn't behave as expected. The following statements don't cause a constraint violation:
    insert into tester values(1,'text');
    insert into tester values(2,'tEXT');
    That is, UNIQUE on a varchar column is case sensitive. How can I create a case-insensitive UNIQUE constraint?
    null

    Take a look at the 'new' feature named function based indexes. I do not now if you can create a unique this way but at least you can try. Keep us informed please.

  • Fragment Err: ORA-00001: unique constraint (CONTRIB.CONTRIBDID_REVERSE_IDX)

    Hi everyone,
    I'm using Site Studio Designer 10gR4 to create a new Fragment for our IGBU Consulting UCM portal. When I "Copy and Edit..." the Dynamic List Generic Fragment, and create a new Fragment Library after trying to save my Fragment, I get the following error:
    <LOG SOURCE="Site Studio Designer" TYPE="ERROR" DATE="08/19/10"
    TIME="10:35:48">Failed to check in file "CNT345727" from location
    "C:\DOCUME~1\cdavis\LOCALS~1\Temp\Stellent\Site
    Studio\1282225052\Fragment
    Library\CNT345727.xml".&lt;BR&gt;&lt;BR&gt;(Unable to execute
    service CHECKIN_UNIVERSAL and function
    docRefinery.&lt;BR&gt;(System Error: Unable to execute query
    'Umeta(update/*+ INDEX (DocMeta PK_DocMeta)*/ DocMeta SET xComments
    = '', xReadOnly = 'FALSE', xTrashDeleteLoc = 0, xTrashDeleteName =
    '', xPriority = 0, xTrashDeleteDate = null, xURLItem = '',
    xForceFolderSecurity = 'FALSE', xHidden = 'FALSE', xTrashDeleter =
    '', xInhibitUpdate = 'FALSE', xDescription = '', xDiscussionCount =
    0, xKeywords = '', xDiscussionType = 'N/A', xOriginalAuthor2 = '',
    xAudience = '', xConfidentiality = '', xOriginalAuthor = '',
    xProductRelease = '', xCollectionID = 0, xIndustry = '',
    xDamCategory = '', xServices = '', xMyOProduct = '', xGeography =
    '', xLanguage = '', xPartitionId = '', xWebFlag = '', xStorageRule
    = 'default', xCreateDate = {ts '2010-08-19 09:12:49.000'},
    xItemStatus = '', xProduct = '', xWebsiteObjectType = 'Fragment',
    xTemplateType = '', xOriginatingSourceFile = '', xWebsites = '',
    xDontShowInListsForWebsites = '', xWebsiteSection = '',
    xCpdIsTemplateEnabled = 0, xCpdIsLocked = 0, xRegionDefinition =
    '', xWikiPageName = '', xRegion = '', xCountry = '', xBusinessArea
    = '', xSiteURLPageName = '', xSiteSearch = 'Index, Follow',
    xADSCertified = '', xADSContentType = '', xEbizOpsTesting = '',
    xTestStatus = '', xADSDemoRelease = '', xProductPillar = '',
    xLastUpdateDate = {ts '2010-08-19 09:35:41.000'}, xProfileTrigger =
    'MYOWebContent', xItemHits = 0, xDisplayURL = '', xLegacyProduct =
    '', xCategoryID = '', xDeleteApproveDate = null, xIsCutoff = '0',
    xRecordCutoffDate = null, xRecordReviewDate = {ts '2010-08-19
    09:35:45.757'}, xRecordSupersededDate = null, xIsFrozen = '0',
    xFreezeID = '', xFreezeReason = '', xIsVital = '0', xVitalReviewer
    = '', xVitalPeriod = 0, xVitalPeriodUnits = '',
    xNoLatestRevisionDate = null, xRecordDestroyDate = null,
    xSuperSupersededDate = null, xDispositionReports = '',
    xRMProfileTrigger = '', xPackagedConversions = '',
    xDamConversionType = '', xVideoRenditions = '', xTUGBU_ContentType
    = '', xConsumptionServer = 'MYO', xDocGeography = '',
    xIndustryCommon = '', xLineOfBusiness = '', xExtensionPeriod = 0,
    xExtensionPeriodUnits = '', xContribDID = 0 WHERE dID = 509938)'.
    ORA-00001: unique constraint (CONTRIB.CONTRIBDID_REVERSE_IDX)
    violated))</LOG>
    Steps to recreate my error:
    1. Copy and Edit... the "Dynamic List Generic" Fragment.
    2. Properties
    a. Name: IGBU Training Request
    b. ID: IGBUTrainingRequest
    c. Language: idoc
    d. Type: dynamiclist
    e. Library Name: SS_FRAGMENTS_EX...
    3. I only changed the Default Value of my ssQueryText Parameter (this is my first Fragment that I'm creating). I am going to have another Form Fragment where consultants can request training classes by filling out some fields, but first I need to make sure my second Fragment will show that content. The Default Value for my ssQueryText Parameter is: (dDocTitle <contains> `Training Request`) <AND> (xWebsites <contains> `igbu`) <AND> (xWebsiteSection <contains> `igbu:6749`). When I run that query in CS, I see 2 records.
    4. I hit the "Save" button, and "New..." to create a new Fragment Library.
    5. When the "Assign Info Form" appears, I fill out the following:
    a. Type: SystemObject - any component of the Web site (fragments, .css, .jsp, etc.)
    b. Title: IGBU Training Request List Fragment
    c. Author: [email protected]
    d. Security Group: Public
    e. Account: EMPL/IGBU/CSLT
    f. Web Sites: IGBU (igbu)
    g. ConsumptionServer: MYO
    6. I click the "Assign Info" button.
    7. I receive the error above.
    I have tried filling in a value for Content ID and leaving it blank when completing the form, thinking that I should let CS assign a CNT***** ID for me, but that did not help.
    Thanks,
    Chad
    Edited by: chad.davis on Aug 19, 2010 9:09 AM
    I was able to fill out the "Assign Info Form" and fill out the fields in #5
    Edited by: chad.davis on Aug 20, 2010 6:50 AM

    Hi mikeyc7m,
    I'm trying to resolve this issue, but I can't tell what to correct...I'm at a complete loss. The Assign Info Form has required fields (red, with asterisks), and I'm filling in values for each of those. Do you have any idea where I can go to verify against a database config setting, or do you have any other ideas?
    Thanks,
    Chad

  • Adding Constraint add extra Index....Why?

    Hi,
    I am creating an index with a field that is function based:
    CREATE INDEX vicc_veh_info##code_year ON vicc_veh_info(UPPER(car_code), model_year DESC, PROGRESS_RECID);
    Now when I create the following constraint:
    ALTER TABLE BILLITEM ADD CONSTRAINT PK_BILLITEM PRIMARY KEY (BUSINESSOBJECTNUM,BUSOBJSEQUENCE,OBJECTNUM,ITEM_NUMBER,ITEMPOST_TYPE);
    It actually creates the constraint and it also creates another Index with the same name as the constraint so when I look at the index it is called PK_BILLITEM and when I look at the table I also see that constraint there as well.
    Why is it doing this. Why does this constraint not just created on it's own???
    Is this because of the function based column in the Index.

    Which index did you specify? The syntax, as per the examples, tells you you can say
    USING INDEX {provide the index definition}
    USING INDEX {provide the name of an existing index}
    Message was edited by: Hans Forbrich
    Copy/paste from the link:
    CREATE TABLE promotions_var3
        ( promo_id         NUMBER(6)
        , promo_name       VARCHAR2(20)
        , promo_category   VARCHAR2(15)
        , promo_cost       NUMBER(10,2)
        , promo_begin_date DATE
        , promo_end_date   DATE
        , CONSTRAINT promo_id_u UNIQUE (promo_id, promo_cost)
             USING INDEX (CREATE UNIQUE INDEX promo_ix1
                ON promotions_var3 (promo_id, promo_cost))
        , CONSTRAINT promo_id_u2 UNIQUE (promo_cost, promo_id)
             USING INDEX promo_ix1);

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

  • ORA-00001: unique constraint error..

    Hi There,
    We were trying to do an insert when we started having ORA-00001: unique constraint error.. to speed our testing we decided to disable all the constraints on the table; however we still having the same issue.
    How can we resolve this please.
    SQL> select constraint_name,constraint_type,status from dba_constraints where table_name='MEMBER_LATEST';
    CONSTRAINT_NAME                C STATUS
    MEMBER_LATEST_PK               P DISABLED
    SYS_C0017577                   C DISABLED
    SYS_C0017576                   C DISABLED
    SYS_C0017575                   C DISABLED
    SYS_C0017574                   C DISABLED
    SYS_C0017573                   C DISABLED
    SYS_C0017572                   C DISABLED
    SYS_C0017571                   C DISABLED
    SYS_C0017570                   C DISABLED
    MEMBER_LATEST_FK               R DISABLED
    10 rows selected.
    SQL>
    SQL>
    SQL>     INSERT INTO MEMBER_LATEST (DIS_ID, TIMESTAMP, LAST_NAME, FIRST_NAME, MIDDLE_NAME, DIS_COUNT)
      2    SELECT DIS_ID, 'TEST', LAST_NAME, FIRST_NAME, MIDDLE_NAME, 0
      3    FROM MV_DIS_MEM, MV_DIS_COUNT
      4    WHERE MV_DIS_MEM.P_CODE =  MV_DIS_COUNT.P_CODE
      5    ORDER BY 1,3,4;
        INSERT INTO MEMSCH.MEMBER_LATEST (DIS_ID, TIMESTAMP, LAST_NAME, FIRST_NAME,
    ERROR at line 1:
    ORA-00001: unique constraint (MEMSCH.MEMBER_LATEST_PK) violated
    SQL>Anything else we can do please?
    Thanks

    rsar001 wrote:
    but isn't the unique index constraint part of the disabled constraints on the table as shown above?Not if index used by PK was created separately prior to PK:
    SQL> create table emp1 as select * from emp;
    Table created.
    SQL> alter table emp1
      2  add constraint emp1_pk
      3  primary key(empno);
    Table altered.
    SQL> insert into emp1 select * from emp;
    insert into emp1 select * from emp
    ERROR at line 1:
    ORA-00001: unique constraint (SCOTT.EMP1_PK) violated
    SQL> alter table emp1 disable primary key;
    Table altered.
    SQL> insert into emp1 select * from emp;
    14 rows created.
    SQL> rollback;
    Rollback complete.
    SQL> alter table emp1 drop primary key;
    Table altered.
    SQL> create unique index emp1_pk on emp1(empno);
    Index created.
    SQL> alter table emp1
      2  add constraint emp1_pk
      3  primary key(empno)
      4  using index emp1_pk;
    Table altered.
    SQL> insert into emp1 select * from emp;
    insert into emp1 select * from emp
    ERROR at line 1:
    ORA-00001: unique constraint (SCOTT.EMP1_PK) violated
    SQL> alter table emp1 disable primary key;
    Table altered.
    SQL> insert into emp1 select * from emp;
    insert into emp1 select * from emp
    ERROR at line 1:
    ORA-00001: unique constraint (SCOTT.EMP1_PK) violated
    SQL> But by dropping index you are simply delaying the issue. Yes, you will be able to insert, but what's then? You will not be able to recreate PK - same violation error will be raised.
    SY.

  • Unique constraint violation while updating a non PK column

    Hi,
    I seem to have found this strange error.
    What I try to do is bulk fetch a cursor in some table arrays. with limit of 1000
    Then using a forall and a save exceptions at the end
    I update a table with the values inside one of the table arrays.
    The column I update is not part of a PK
    I catch the error message: ORA-24381
    by using PRAGMA exception_init(dml_errors, -24381);
    and later on :
    WHEN dml_errors THEN
    errors := SQL%BULK_EXCEPTIONS.COUNT;
    FOR i IN 1..sql%BULK_EXCEPTIONS.count LOOP
    lr_logging.parameters:= 'index = ' || sql%BULK_EXCEPTIONS(i).error_index || 'error = ' ||Sqlerrm(-sql%BULK_EXCEPTIONS(i).error_code) ;
    END LOOP;
    I insert these errors in another table. and i get 956 errors
    first one is :
    index = 3error = ORA-00001: unique constraint (.) violated
    last one is
    index = 1000error = ORA-00001: unique constraint (.) violated
    How can this be.Since i don't update in a PKcolumn.
    FULL CODE IS:
    PROCEDURE Update_corr_values( as_checkdate_from IN VARCHAR2,
    as_checkdate_until IN VARCHAR2,
    as_market IN VARCHAR2
    IS
    LS_MODULE_NAME CONSTANT VARCHAR2(30) := 'update_values';
    lr_logging recon_logging.logrec;
    CURSOR lc_update IS
    SELECT /*+ORDERED*/c.rowid,c.ralve_record_id,d.value,c.timestamp,f.value
    FROM rcx_allocated_values a,
    rcx_allocated_values b,
    meter_histories e,
    rcx_allocated_lp_value c,
    rcx_allocated_lp_value d,
    counter_values f
    WHERE a.slp_type NOT IN ('S89', 'S88', 'S10', 'S30') --AELP
    AND b.slp_type IN ('S89', 'S88') --residu
    AND a.valid_from >= to_date(as_checkdate_from,'DDMMYYYY HH24:MI')
    AND a.valid_to <= to_date(as_checkdate_until,'DDMMYYYY HH24:MI')
    AND a.market = as_market
    AND a.market = b.market
    AND a.ean_sup = b.ean_sup
    AND a.ean_br = b.ean_br
    AND a.ean_gos = b.ean_gos
    AND a.ean_dgo = b.ean_dgo
    AND a.direction = b.direction
    AND a.valid_from = b.valid_from
    AND a.valid_to = b.valid_to
    AND c.ralve_record_id = a.record_id
    AND d.ralve_record_id = b.record_id
    AND c.TIMESTAMP = d.TIMESTAMP
    AND e.ASSET_ID = 'KCF.SLP.' || a.SLP_TYPE
    --AND f.timestamp between to_date(gs_checkdate_from,'ddmmyyyy') and to_Date(as_checkdate_until,'ddmmyyyy')
    AND e.SEQ = f.MHY_SEQ
    AND f.TIMESTAMP =c.timestamp - 1/24
    ORDER BY c.rowid;
    TYPE t_value IS TABLE OF RCX_ALLOCATED_LP_VALUE.VALUE%TYPE;
    TYPE t_kcf IS TABLE OF COUNTER_VALUES.VALUE%TYPE;
    TYPE t_timestamp IS TABLE OF RCX_ALLOCATED_LP_VALUE.TIMESTAMP%TYPE;
    TYPE t_ralverecord_id IS TABLE OF RCX_ALLOCATED_LP_VALUE.RALVE_RECORD_ID%TYPE;
    TYPE t_row IS TABLE OF UROWID;
    ln_row t_row :=t_row();
    lt_value t_value := t_Value();
    lt_kcf t_kcf := t_kcf();
    lt_timestamp t_timestamp := t_timestamp();
    lt_ralve t_ralverecord_id := t_ralverecord_id();
    v_bulk NUMBER := 1000;
    val number;
    kcf number;
    ralve number;
    times date;
    dml_errors EXCEPTION;
    errors NUMBER;
    PRAGMA exception_init(dml_errors, -24381);
    BEGIN
    --setting arguments for the logging record
    lr_logging.module := LS_MODULE_NAME;
    lr_logging.context := 'INFLOW_ALL_VALUES_PARTS';
    lr_logging.logged_by := USER;
    lr_logging.parameters := 'Date time started: ' || TO_CHAR(sysdate,'DD/MM/YYYY HH24:MI');
    -- log debugs
    recon_logging.set_logging_env (TRUE, TRUE);
    recon_logging.log_event(lr_logging,'D');
    OPEN lc_update;
    LOOP
    FETCH lc_update BULK COLLECT INTO ln_row,lt_ralve,lt_value,lt_timestamp,lt_kcf LIMIT v_bulk;
    FORALL i IN NVL(lt_value.first,1)..NVL(lt_value.last,0) SAVE EXCEPTIONS
    UPDATE RCX_ALLOCATED_LP_VALUE
    SET VALUE = VALUE * lt_value(i) * lt_kcf(i)
    WHERE rowid =ln_row(i);
    COMMIT;
    lt_value.delete;
    lt_timestamp.delete;
    lt_ralve.delete;
    lt_kcf.delete;
    ln_row.delete;
    EXIT WHEN lc_update%NOTFOUND;
    END LOOP;
    CLOSE lc_update;
    recon_logging.log_event(lr_logging,'D');
    lr_logging.parameters := 'Date time ended: ' || TO_CHAR(sysdate,'DD/MM/YYYY HH24:MI');
    recon_logging.log_event(lr_logging,'D');
    --to be sure
    COMMIT;
    EXCEPTION
    WHEN dml_errors THEN
    recon_logging.set_logging_env(TRUE,TRUE);
    lr_logging.module := 'updatevalues';
    lr_logging.context := 'exception';
    lr_logging.logged_by := USER;
    lr_logging.parameters := 'in dml_errors';
    recon_logging.log_event(lr_logging);
    errors := SQL%BULK_EXCEPTIONS.COUNT;
    lr_logging.parameters:=errors;
    recon_logging.log_event(lr_logging);
    lr_logging.parameters :=('Number of errors is ' || errors);
    --DBMS_OUTPUT.PUT_LINE('Number of errors is ' || errors);
    FOR i IN 1..sql%BULK_EXCEPTIONS.count LOOP
    lr_logging.parameters:= 'index = ' || sql%BULK_EXCEPTIONS(i).error_index || 'error = ' ||Sqlerrm(-sql%BULK_EXCEPTIONS(i).error_code) ;
    recon_logging.log_event(lr_logging);
    END LOOP;
    --recon_logging.set_logging_env(TRUE,TRUE);
    --recon_logging.log_event(lr_logging);
    commit;
    WHEN OTHERS THEN
    lr_logging.module := 'updatevalues';
    lr_logging.context := 'exception';
    lr_logging.logged_by := USER;
    recon_logging.set_logging_env(TRUE,TRUE);
    lr_logging.parameters := 'in others error=' || SQLERRM;
    recon_logging.log_event(lr_logging);
    commit;--to look which is truly the last (else only commit after 1000)
    --raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
    END Update_corr_values;

    Hi,
    No I didn't update a unique constraint.
    But I found out that there is a trigger that causes the unique constraint while updating in the table.
    Silly mistake.Didn't know there was a trigger there.
    Thx anyway.
    Greetz

Maybe you are looking for

  • My ipod touch is no longer syncing with itunes

    not used the ipod for a while and wanted to update it last night. i changed the manual drag to tick as wanted all the recents downloads on the ipod. took nearly 3 hours for 270 songs to transfer. when finished i went to play a song but it had not tra

  • Gift card money given to somebody else.

    I recently tried to redeem a gift card my father got me for Christmas last year. When I entered the code, I was given an error. I then contacted support, who e-mail me a cut and paste response to try again. I did not have a chance that day. When I di

  • Need a simple answer for simple question???

    simple question... what is the best way to export my fce movie and burn it on idvd for the best quality for genaral use ... sd..4x3 ratio tv.. lots of ken burn effects on photos... lots of sd video... ??? not so simple answer... i have read manuals..

  • How to Aviod  the appearance of the MIDlet Name From The Screen

    hi I am working with Mobile application, while running the application the MIDlet file name is always visible on the screen. So that the image moved down and partly hiden. how to aviod this problem

  • HP Support Assistant bug

    When I open HP Support Assistant I got stuck at the "Welcome to HP Support Assistant" screen and couldn't press the Next button to go any further. All the other options I can still press but it won't apply until I press the next button. It's like the