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

Similar Messages

  • How to create unique constraint in ODI

    Hi
    I have view at source side, I want to store source data to target interface table.
    For that I need to create UNIQUE constraint at source side to identify the unique records.
    I have composite primary key example as follow
    desc Test_V;
    orderID NUMBER,
    itemNumber NUMBER,
    productId NUMBER,
    quantity NUMBER,
    lot_number varchar2(80)
    where
    PRIMARY KEY (orderID, itemNumber,lot_number);
    Some times, lot_number can be null, So, I can't use lot_number in composite key (as per requirement)
    Please any body can help me on it
    Thanks
    Phani

    Hi
    Hope this may help
    http://mhimu.wordpress.com/2009/05/04/odi-incremental-update-and-surrogate-key-using-database-sequence/
    but some cases it is not working
    Thanks
    Phani

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

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

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

  • How to create Unique constraint

    Hi,
    How can I create a unique constraint on a column in a table which has already been created.
    Thanks

    ALTER TABLE your_table ADD CONSTRAINT yrt_uk UNIQUE (some_col)
    /You may find it illuminating to read the online documentation.
    Cheers, APC

  • Unique Constraint Not Allowed in OA Table design?

    Is it really true or is just my OApps Admin /DBA is just plain stupid for not allowing unique constraint at table level?
    I have to implement a EO attribute level validation that does a select on an unindexed field thru the List Validator feature.
    The problem is it is taking 40-60 seconds to commit something to the EO.

    Thats true, if talking about only OAF, you don't need the constraint as you can handle that in code!
    --Mukul                                                                                                                                                                                                                                                       

  • 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

  • NOT NULL Unique Constraint in Data Modeler

    I've created Unique Constraints in the Relational Model and I'm trying to figure out how to make it a NOT NULL constraint.
    Let's say the table name is category with columns cat_id, cat_name, sort.
    In SQL I create "ALTER TABLE category MODIFY (category CONSTRAINT xxx_cat_name_nn NOT NULL);", but inside the modeler there is no data entry points in the [Unique Key Properties - xxx_cat_name_nn] dialog box, that I can find, that lets me tell it that it is a NOT NULL constraint. I'm sure there is a way but I'm just fall over my own feet trying to find it.
    Any help would be greatly appricated.
    Edited by: 991065 on Feb 28, 2013 1:40 PM

    Hi,
    You can make the column NOT NULL by unsetting the "Allow Nulls" property for the Column.
    If you want a named NOT NULL Constraint, you should also set the "Not Null Constraint Name" property (on the Default and Constraint tab of the Column Properties dialog).
    David

  • Paralell in enable unique constraint

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

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

  • Simple unique constraint question

    HI ALL,
    I have created a table as below, and added unique key to both the col of the table.
    CREATE TABLE TT( A NUMBER,B NUMBER);
    ALTER TABLE TT ADD CONSTRAINT UNQ_CNT UNIQUE(A,B);
    INSERT INTO TT VALUES (&A,&B);
    Enter value for a: 1
    Enter value for b: null
    Enter value for a: 1
    Enter value for b: null
    ORA-00001: unique constraint (SCOTT.UNQ_CNT) violatedwhy I am getting the above err as Null cannot be equal to Null so the record
    should be unique from other record.
    Kindly help in understanding this concept.
    Regards,
    AAK.

    AAK,
    When you create UNIQUE constraint on multiple
    NULLABLE columns, uniqueness is checked for NON-NULL
    values. So in your case, when you try to insert
    another row, ORACLE detects that column A already has
    same value (1) and hence it gives error. You can find
    more details in documentation.Two rows that contain nulls for one or more key columns and the same
    combination of values for the other key columns violate the constraint.
    Not for NON-NULL values only.
    Khurram

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

  • Post Process Event Handler ----Unique Constraint Violation--Create User

    Hi Evryone..
    I am creating the user using the create user request template and there is one level of approval for this.
    I have one pre process event handler which populates one field A and one post process event handler which updates some 3 fields in the user form .
    In request template itself we had placed value as "ABC" for field B and this field B will be overridden in the post process event handler with Value as "XYZ" .
    Now when i raise the request the user is getting created in OIM but the value XYZ is not getting replaced in the field B.
    Below are the errors which i got in the logs while executing post process event handler :
    <Mar 28, 2012 10:25:58 AM CDT> <Warning> <oracle.iam.callbacks.common> <IAM-2030146> <[CALLBACKMSG] Are applicable policies present for this async eventhandler ? : false>
    <Mar 28, 2012 10:25:59 AM CDT> <Warning> <org.eclipse.persistence.session.oim> <BEA-000000> <
    Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.1.3.v20110304-r9073): org.eclipse.persistence.exceptions.DatabaseException
    Internal Exception: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (DEV_OIM.UK_UAR_ATTR_NAME_VALUE) violated
    Error Code: 1
    Call: INSERT INTO USR_ATTRIBUTE_RESERVATIONS (UAR_RESERVATION_KEY, UAR_ATTRIBUTE_NAME, CREATED_BY, CREATED_ON, DATA_LEVEL, UAR_REQUEST_ID, UAR_RESERVED_VALUE, UPDATED_BY, UPDATED_ON) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
    bind => [10, User Login, null, null, null, 10, DUMMY14, null, null]
    Query: InsertObjectQuery([email protected]658269)
    Exception at usrIntf.updateUser IAM-3050128 : Cannot reserve user attribute User Login with value DUMMY14 in OIMDB. Corresponding request ID is 10.:User Login:DUMMY14:10
    I checked reservations table and there are no records in that table.
    Has any one faced this issue..if so how it can be resolved..

    Are you trying to update the User ID? As far as I know during create user requests, OIM reserves the user login as it goes through approval and you cannot update that directly I think. I haven't tried it but can you tell me which fields you are prepopulating and which are you updating? Are there any OOTB fields in this or UDF?
    -Bikash

  • Table with unique Constraint

    Dear All
    i have a a project ADF-BC / JSF - JDeveloper 11.1.2.3.0 latest, and i have EO contains PK constrain in db in 2 fields (userid & Roleid) and i implemented bundle to handle error message with jbo error code and it works fine in AM test
    and i have VO contains LOV in one attribute of this unique constrain columns (Roleid), now i dropped VO in jsf page as a af:table as below with input text with list of values for roleid and auto submit = true , and i face unexpected behavior from lov attribute in case of entering repeated value ..
    when i enter another repeated value , it give me error message i created in the bundle and everything ok until now
    but when i tab out of input text with list of values , it go back to old value as may be validation fired in back ground , it is not a problem until now
    when i try to make anything else, he still gives me error message of duplicated key
    i change the value again to correct value to avoid duplication error message , i am surprised , still i get the error message and shows me the repeated value again !!
    simply it still save the old repeated value however i corrected , please any one help me to know what is happening and how to solve ?
    Attribute in EO :
    <Attribute
    Name="RoleId"
    Precision="10"
    ColumnName="ROLE_ID"
    SQLType="VARCHAR"
    Type="java.lang.String"
    ColumnType="VARCHAR2"
    TableName="USER_ROLES"
    PrimaryKey="true">
    <DesignTime>
    <Attr Name="_DisplaySize" Value="10"/>
    </DesignTime>
    <validation:ExistsValidationBean
    Name="RoleId_Rule_1"
    ResId="CS.model.BC.EO.UserRolesEO.RoleId_Rule_1"
    OperandType="EO"
    AssocName="CS.model.BC.ASS.UsersRolesFk2ASS"/>
    </Attribute>
    Interface af : table
    <af:table value="#{bindings.UserRoles2.collectionModel}" var="row"
    rows="#{bindings.UserRoles2.rangeSize}"
    emptyText="#{bindings.UserRoles2.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.UserRoles2.rangeSize}"
    rowBandingInterval="0"
    filterModel="#{bindings.UserRoles2Query.queryDescriptor}"
    queryListener="#{bindings.UserRoles2Query.processQuery}"
    filterVisible="true" varStatus="vs"
    selectedRowKeys="#{bindings.UserRoles2.collectionModel.selectedRow}"
    selectionListener="#{bindings.UserRoles2.collectionModel.makeCurrent}"
    rowSelection="single" id="t1" columnSelection="none"
    columnStretching="column:c3">
    <af:column sortProperty="#{bindings.UserRoles2.hints.RoleId.name}"
    filterable="true" sortable="true"
    headerText="#{bindings.UserRoles2.hints.RoleId.label}"
    id="c2">
    <af:inputListOfValues id="roleIdId"
    popupTitle="Search and Select: #{bindings.UserRoles2.hints.RoleId.label}"
    value="#{row.bindings.RoleId.inputValue}"
    model="#{row.bindings.RoleId.listOfValuesModel}"
    required="#{bindings.UserRoles2.hints.RoleId.mandatory}"
    columns="#{bindings.UserRoles2.hints.RoleId.displayWidth}"
    shortDesc="#{bindings.UserRoles2.hints.RoleId.tooltip}"
    autoSubmit="true" editMode="select">
    <f:validator binding="#{row.bindings.RoleId.validator}"/>
    </af:inputListOfValues>
    </af:column>
    <af:column sortProperty="#{bindings.UserRoles2.hints.RoleName.name}"
    sortable="true"
    headerText="#{bindings.UserRoles2.hints.RoleName.label}"
    id="c3">
    <af:outputFormatted value="#{row.bindings.RoleName.inputValue}"
    id="of7" partialTriggers="roleIdId"/>
    </af:column>
    <af:column sortProperty="#{bindings.UserRoles2.hints.Active.name}"
    filterable="true" sortable="true"
    headerText="#{bindings.UserRoles2.hints.Active.label}"
    id="c4">
    <af:outputFormatted value="#{row.bindings.Active.inputValue}"
    id="of8" partialTriggers="roleIdId"/>
    </af:column>
    </af:table>
    Edited by: user8854969 on Oct 7, 2012 1:34 PM
    Edited by: user8854969 on Oct 7, 2012 2:16 PM

    I believe there is a little confusion here. The error I am encountering has to do with a unique constraint violation and not a foreign key constraint. If I have the data:
    PK FK sequence
    1 5 1
    2 5 2
    3 5 3
    with a unique constraint on (FK, sequence) and want to change it to:
    PK FK sequence
    1 5 1
    4 5 2 --insert
    2 5 3 --update on sequence
    3 5 4 --update on sequence
    I am currently getting a unique constraint violation because the insert is issued before the updates, and the updates alone cause problems because they are issued out of order (i.e. if I do the shifting operation without the insertion of a new record).

  • Tip: Unique Constraint on Part of Table

    Here's a cute little trick I picked up from where it was hiding deep within one of the manuals:
    Consider a table where one column needs to be unique, but only part of the time based on some condition within the row. For example, col1 must be unique when its value is above 1000 but any number of rows can have the same value for col1 when it is 999 or less. Another example would be a flag column that determines that col1 must be unique. Don't ask me WHY you would do either of these things.
    Here's how to accomplish the first example (btw both examples require a PK on the table):
    CREATE TABLE junk(
    junk_key INTEGER NOT NULL,
    col1 INTEGER NOT NULL,
    CONSTRAINT pk_junk PRIMARY KEY(junk_key)
    --The way we accomplish this is with a function-based index. 
    CREATE UNIQUE INDEX idx_semiuniq ON junk(
    CASE WHEN col1>=1000 THEN TO_CHAR(col1) ELSE '~' || TO_CHAR(junk_key) END);
    --The following statements should succeed:
    insert into junk values(1,1);
    insert into junk values(2,1);
    insert into junk values(3,1000);
    insert into junk values(4,1001);
    update junk set col1=1002 where junk_key=4;
    --The following statements should fail:
    insert into junk values(5,1000);
    update junk set col1 = 1001 where junk_key=1;
    The same strategy applies to the second example, except that in this case we'll need an additional column to indicate that col1 needs to be unique:
    CREATE TABLE junk( junk_key INTEGER NOT NULL,
    col1 INTEGER NOT NULL,
    uniq_flag CHAR(1) NOT NULL,
    CONSTRAINT pk_junk PRIMARY KEY(junk_key),
    CONSTRAINT ck_junk CHECK (uniq_flag IN ('Y','N'))
    CREATE UNIQUE INDEX idx_semiuniq ON junk(CASE WHEN uniq_flag = 'Y' THEN TO_CHAR(col1) ELSE '~' || TO_CHAR(junk_key) END);
    --these should succeed:
    insert into junk values(1,1,'N');
    insert into junk values(2,1,'N');
    insert into junk values(3,1,'Y');
    insert into junk values(4,2,'Y');
    --these should fail:
    insert into junk values(5,2,'Y');
    update junk set uniq_flag='Y' where junk_key=2;
    Another way to accomplish this is with a "not exists" in a check constraint, but I think the function-based index will perform better especially when inserting or updating large numbers of rows.

    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.

  • Create unique index on flow table

    Hi
    I always get this error 'Create unique index on flow table ERROR" while implementing SCD2. Please help me.I have made an Update Key which is a combination of 4 columns that want a new row to be inserted if there is a change in data.One of the above columns is the EMPLOYEE ID,
    My surrogate key is the table's primary key but I have not defined it as a key in mapping and also I have turned off the Primary Key Constraint Option in Controls Panel as NO.
    Where am I wrong? Also please tell me what to take care off while making Natural Key ?

    There are two solutions:
    1. Only use uppercase in the table name
    2. go in Topology>Physical Architecture and edit the technology, then click on
    the "Language" tab and set "Object Delimiter" to empty.
    Thanks,
    Sutirtha

  • Table does not exist when creating FK Constraint across schemas

    Hi all,
    This will probably boil down to a permissions issue since I'm sketchy on the various levels....
    I'm testing a conversion to Oracle from our legacy system. There are 4 schemas which I've created and each of those schema users have been granted DBA roles.
    After creating a number of tables I wrote the SQL to create the FK Constraints. Most of them went in, but the ones crossing schemas don't. Logged in as SYS, I can do a select from each table, I can even JOIN the two in the SELECT. However when I try creating the constraint it give me a: ORA-00942: table or view does not exist
    ALTER TABLE USERA.TABLEA ADD FOREIGN KEY (COLA) REFERENCES USERB.TABLEB (COLA) ON DELETE CASCADE
    Again, I have scads of commands that went in correctly so this must be a permissions type thing. I'm the only one logged into the database since it's my own test system. This is 10g BTW.
    If you have any suggestions as what to look into, please explain how to actually perform the checks since I'm still learning how to get around.
    Thanks very much!

    To bulk grant, you can use dynamic SQL; somthing like this:
    <BR><BR>
    SQL> declare
      2    l_grantor VARCHAR2(30) := 'USERA';
      3    l_grantee VARCHAR2(30) := 'USERB';
      4  begin
      5    for table_rec in (select owner,table_name from all_tables where OWNER=l_grantor) loop
      6      execute immediate 'GRANT REFERENCES ON '||table_rec.OWNER||'.'||table_rec.TABLE_NAME||' TO '||l_grantee;
      7    end loop;
      8  end;
      9  /

Maybe you are looking for

  • Unable to load Applet in JSP using Tomcat 5.5.12

    Hi I am aunable to applet in jsp using Tomcat 5.5.12 and JRE 1.5. Below is the code that I am using                                    <applet                                    codebase = "."                                    archive = "WebPOSApple

  • Word 97

    We've recently changed to the Office 97 suite & are having some problems with apps that startup Word. They startup fine but when you shutdown the Forte app, it doesn't shutdown Word? This used to work for Word 95?? Do we have to run the OLEGEN utilit

  • Contact correcting itself? One-name contacts?

    Hi - I'm having a bizarre issue. I have my dad's info in address book listed under "Dad". His name is Allen Hollister, but I do not put that in my contact. Just Dad. No last name. It syncs fine with .Mac and my iPhone as Dad, but for some reason, eve

  • Viewing calendar using link sent with webclient

    Here is what may be an easy question, yet I haven't found the answer... While in the webclient, I can send people a link to view my calendar. When the person I sent the link to goes to that URL, they see the times and "busy". Is there a way to allow

  • Wont Pick Up my passport connection

    My computer wont pick up the connection to the passport. I have the right cords and do i have to use two cords. Also how do you get off the passport onto the computer? Help