Unique Constraint on CLOB XML

From my research it appears you can't put a unique constraint on an xml record if the xml is stored as a CLOB. Could somebody confirm I am correct?
If I'm wrong please provide an example on how do do it on the value attribute for the "key" node in following xml:
<DomainObject className="Building" xmlns="hello world">
<primitive value="1" name="key"/>
<primitive value="111" name="jobId"/>
<primitive value="1.0" name="height"/>
</DomainObject>
Thanks,
Steve

Since nobody responded I wung it. Even in schema based XML I don't think there is a way to put a unique constraint on the column in the way I needed it, so I wrote a BEFORE INSERT trigger which makes sure the key being inserted doesn't duplicate a key already in the table.
Steve

Similar Messages

  • Add a unique constraint on binary XML table

    How add a unique constraint of "brevet" field?
    The following INSERT failed
    SQL Error: ORA-19025: EXTRACTVALUE renvoie la valeur d'un seul noeud
    19025. 00000 - "EXTRACTVALUE returns value of only one node"
    If the ALTER is made after the INSERT is done, INSERT is valid but ALTER failed with the same error message!
    /* copy the file compavions.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <compagnie>
         <comp>AB</comp>
         <flotte>
              <avion immat="F-WTSS" capacite="90">
                   <typeAv>Concorde</typeAv>
              </avion>
              <avion immat="F-GFDR" capacite="145">
                   <typeAv>A320</typeAv>
              </avion>
              <avion immat="F-GTYA" capacite="150">
                   <typeAv>A320</typeAv>
              </avion>
         </flotte>
         <nomComp>Air Blagnac</nomComp>
         <pilotes>
              <pilote>
              <brevet>PL-1</brevet>
              <nom>C. Sigaudes</nom>
              </pilote>
              <pilote>
              <brevet>PL-2</brevet>
              <nom>P. Filloux</nom>
              </pilote>
         </pilotes>
    </compagnie>
    in C:\...
    --DROP DIRECTORY repxml;
    --CREATE DIRECTORY repxml AS 'C:\...';
    DROP TABLE pilote_binary_xml5;
    CREATE TABLE pilote_binary_xml5 OF XMLType
    XMLTYPE STORE AS BINARY XML
    VIRTUAL COLUMNS
    (col AS (EXTRACTVALUE(OBJECT_VALUE, '/compagnie/pilotes/pilote/brevet')));
    ALTER TABLE pilote_binary_xml5 ADD CONSTRAINT brevet_unique UNIQUE (col);
    INSERT INTO pilote_binary_xml5 VALUES (XMLType(BFILENAME ('REPXML','compavions.xml'), NLS_CHARSET_ID ('AL32UTF8')));
    --ALTER TABLE pilote_binary_xml5 ADD CONSTRAINT brevet_unique UNIQUE (col);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    You could try something like
    (extract(OBJECT_VALUE,compagnie/pilotes/pilote/brevet').getStringVal());
    but this is probably unadvisable.
    I suggest an alternative is for you to look at XMLINDEX so that you can bring the 'proper' XML functions into play like XMLTABLE etc.

  • Composite unique constraint on parent and child values?

    Is it possible to have a composite unique constraint containing values from child elements? The below example has the 'child' elements are out-of-line but this is preferred but optional, as I know you cannot have a unique constraint across tables without having a reference table containing the constraint and both columns. How does xdb handle this requirement?
    allowed:
    <parent ID="1">
       <child><name>test1</name></child>
       <child><name>test2</name></child>
    </parent>
    <parent ID="2">
       <child><name>test1</name></child>
       <child><name>test2</name></child>
    </parent>not allowed:
    <parent ID="1">
       <child><name>test1</name></child>
       <child><name>test1</name></child>
    </parent>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
               xmlns:xdb="http://xmlns.oracle.com/xdb"
               xdb:storeVarrayAsTable="true"
               elementFormDefault="qualified">
        <xs:element name="parent" type="Parent_T"
            xdb:columnProps="CONSTRAINT parent_pkey PRIMARY KEY (XMLDATA.ID)"
            xdb:defaultTable="PARENT"/>
        <xs:complexType name="Parent_T" xdb:SQLType="PARENT_T" xdb:maintainDOM="false">
            <xs:sequence>
                <xs:element name="child" type="Child_T" minOccurs="1" maxOccurs="unbounded" xdb:SQLName="CHILD"
                          xdb:SQLInline="false" xdb:defaultTable="CHILD" "/>
            </xs:sequence>
            <xs:attribute name="ID" xdb:SQLName="ID" use="required" />
        </xs:complexType>
        <xs:complexType name="Child_T" xdb:SQLType="CHILD_T">
           <xs:sequence>
             <xs:element name="name" type="xs:string" xdb:SQLName="NAME"/>
           </xs:sequence>
         </xs:complexType>    
    </xs:schema>xdb:columnProps="CONSTRAINT parent_pkey PRIMARY KEY (XMLDATA.ID),*UNIQUE(XMLDATA.CHILD.NAME)*" raises nonexistant attribute
    One possible solution would be to copy the value of the parent primary key to the child element, then I could create a composite unique constraint using only values from the child. However, I have this same requirement elsewhere in my schema nested further down, and it may become messy / bad design having to cascade all the primary keys down the schema. For example I have a recursive element in which two attributes need to be unique only within the parent:
    <parent id="1">
       <child a="1" b="1">
          <child a="1" b="2">
             <child a="1" b="1" /> *not allowed
          </child>
       </child>
       <child a="1" b="2" /> *not allowed
    </parent>Possible fix:
    <child a="1" b="2" parent_id="1" />
    <xs:complexType name="Child_T>
       <xs:sequence>
          <xs:element name="child" xsd:SQLInline="false" xsd:columnProps="UNIQUE(XMLDATA.a,XMLDATA.b,XMLDATA.parent_id)" minOccurs="0" maxOccurs="unbounded" type="Child_T">
       </xs:sequence>
       </xs:element
    </xs:complexType>Is there a better design?
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production                          
    CORE     10.2.0.4.0     Production                                      
    TNS for Linux: Version 10.2.0.4.0 - Production                  
    NLSRTL Version 10.2.0.4.0 - Production

    You can do something like this :
    SQL> DECLARE
      2 
      3    xsd_doc xmltype := xmltype('<?xml version="1.0" encoding="utf-8"?>
      4  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
      5    <xs:element name="name" xdb:SQLType="VARCHAR2">
      6      <xs:simpleType>
      7        <xs:restriction base="xs:string">
      8          <xs:maxLength value="30"/>
      9        </xs:restriction>
    10      </xs:simpleType>
    11    </xs:element>
    12    <xs:element name="child" xdb:SQLType="CHILD_T">
    13      <xs:complexType xdb:SQLType="CHILD_T" xdb:maintainDOM="false">
    14        <xs:sequence>
    15          <xs:element ref="name"/>
    16        </xs:sequence>
    17      </xs:complexType>
    18    </xs:element>
    19    <xs:element name="parent" xdb:SQLType="PARENT_T">
    20      <xs:complexType xdb:SQLType="PARENT_T" xdb:maintainDOM="false">
    21        <xs:sequence>
    22          <xs:element ref="child" maxOccurs="unbounded" xdb:SQLCollType="CHILD_COLL"/>
    23        </xs:sequence>
    24        <xs:attribute name="ID" type="xs:integer" use="required"/>
    25      </xs:complexType>
    26    </xs:element>
    27    <xs:element name="root" xdb:defaultTable="MY_XML_TABLE" xdb:SQLType="ROOT_T">
    28      <xs:complexType xdb:SQLType="ROOT_T" xdb:maintainDOM="false">
    29        <xs:sequence>
    30          <xs:element ref="parent" maxOccurs="unbounded" xdb:SQLCollType="PARENT_COLL"/>
    31        </xs:sequence>
    32      </xs:complexType>
    33    </xs:element>
    34  </xs:schema>');
    35 
    36  BEGIN
    37 
    38    dbms_xmlschema.registerSchema(
    39      schemaURL => 'test_parent.xsd',
    40      schemaDoc => xsd_doc,
    41      local => true,
    42      genTypes => true,
    43      genbean => false,
    44      genTables => false,
    45      enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_NONE
    46    );
    47 
    48  END;
    49  /
    PL/SQL procedure successfully completed
    SQL> CREATE TABLE my_xml_table OF XMLTYPE
      2  XMLTYPE STORE AS OBJECT RELATIONAL
      3  XMLSCHEMA "test_parent.xsd"
      4  ELEMENT "root"
      5  VARRAY xmldata."parent" STORE AS TABLE my_parent_tab
      6  (
      7    VARRAY "child" STORE AS TABLE my_child_tab
      8  )
      9  ;
    Table created
    SQL> ALTER TABLE my_parent_tab ADD CONSTRAINT parent_uk UNIQUE (nested_table_id, "ID");
    Table altered
    SQL> ALTER TABLE my_child_tab ADD CONSTRAINT child_uk UNIQUE (nested_table_id, "name");
    Table altered
    Then :
    SQL> insert into my_xml_table values (
      2  xmltype('<root><parent ID="1">
      3     <child><name>test1</name></child>
      4     <child><name>test2</name></child>
      5  </parent>
      6  <parent ID="1">
      7     <child><name>test1</name></child>
      8     <child><name>test2</name></child>
      9  </parent></root>')
    10  );
    insert into my_xml_table values (
    ERREUR à la ligne 1 :
    ORA-00001: violation de contrainte unique (DEV.PARENT_UK)
    SQL> insert into my_xml_table values (
      2  xmltype('<root><parent ID="1">
      3     <child><name>test1</name></child>
      4     <child><name>test1</name></child>
      5  </parent>
      6  <parent ID="2">
      7     <child><name>test1</name></child>
      8     <child><name>test2</name></child>
      9  </parent></root>')
    10  );
    insert into my_xml_table values (
    ERREUR à la ligne 1 :
    ORA-00001: violation de contrainte unique (DEV.CHILD_UK)
    SQL> insert into my_xml_table values (
      2  xmltype('<root><parent ID="1">
      3     <child><name>test1</name></child>
      4     <child><name>test2</name></child>
      5  </parent>
      6  <parent ID="2">
      7     <child><name>test1</name></child>
      8     <child><name>test2</name></child>
      9  </parent></root>')
    10  );
    1 ligne créée.http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb06stt.htm#sthref987

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

  • 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

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

  • 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

  • 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!"

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

  • 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 Violation Error

    We are upgrading our NW BW 7.01 java server to 7.3 and during the Downtime phase of the Installer, while running the Offline Migration, we are getting an error "EP-KM-BC: Unique Constraint Violation error: ORA-000001".  Unknown Object# (12xxxxxx) does not exist. We have one CI and two DI. Any help would be greatly appreciated.

    Hi Anil,
    You need to clear the data from the table
    1. SHD_AP_PROPVALUE
    2. SHD_KMC_AP_PROP
    3. SHD_AP_MC
    Repeat the phase and also follow the sapnote
    1873288 - RUN_OFFLINE_MIGRATION phase fails during SAP NetWeaver migration
    Also paste the logs of RUN_OFFLINE_MIGRATION phase.
    With Regards
    Ashutosh Chaturvedi

Maybe you are looking for

  • Using a Master Purchase Order to Create Child PO's

    My client needs the ability to create a master PO at the beginning of the year to capture all of the items and item prices that will be ordered from a contract manufacturer vendor.  When they need to order product, they want to copy the master PO to

  • How do I combine multiple PDF using PHP on Linux

    Hi, I would like to know if there is an Adobe product that can combine multiple PDF's into a single document and works on Linux? We are developing an application using PHP on Linux that has to combine selected PDF's and would like to know if there is

  • FM for checking valid drive on PC

    Hi all, I am developing an interface. There is one file which is to be uplaoded in my code. I am doing some processing on that code and downloading that file on PC. User will enter the input & output file name. When user will enter the path I want o

  • SAP License for ABAP

    Dear all We are using ECC6.0. We needed to some upgradation work on our development system. After this, we lost our credentials as hardware key and Expiry date with SLICENSE. It is showing an expired temporary license as Old license and two valid lic

  • How to organize image libraries from lightroom

    just getting started on my new Imac... I have years worth of images stored on two hard drives and a laptop and a pc.  Many duplicates since I am constantly worried about crashes and the like. My best effort to organize was done about 5 months ago on