need to based on the primary key of different table 2 foreign key constraint

I'm using Oracle 11.2.0.3.

I have 2 table invl with invl_pk as primary key and org with org_pk as the primary key.

In the third table entity_list, I have entity_pk that can be indvl_pk or org_pk.   How can I create this constraint?

Thanks for your time.

Hello

Assuming that your model is correct, then what you describe is a normal type of ER modeling construction known as a relationship of the CRA. It is characterized by an entity with two or more links that are mutually exclusive to each other (XOR). A typical example may be where a person entity and an entity of the Organization relate both to a bank account entity, but a bank account can only be used by a person or an organization in a mutually exclusive way. In order to serve this on a diagram, an arc is drawn between effective relationships on the side of the child, where the name of a relationship of the CRA.

Google will be of multiple examples and explanations.

In a perspective of physical databases, this can be implemented in general in two different ways.

1. assuming that all parents in the relationship of the CRA have identical PK, that is to say, a number that is generated, the child may have a FK of the same type and an entity of type column that defines what entity the FK is. The advantage of this is that it is a bit more compact and is expandable without schema changes if you want to add more relationships. The downside of this is that the CF cannot be defined at the database level and will build on the code to be executed or both in the application and the database as a trigger.

2. regardless of types PK for parent entities, the child has a separate optional FK appropriate for each relationship in the arc. Each FK is defined at the database level while maintaining the exclusivity of relationships, a constraint is defined on the table that prevents several FK being filled for a given instance. This can be a little messier that there must be a (column/s) FK for each relationship in the arc, but the relationship may be limited to the level of the object database with the help of FK constraints and a check constraint. This could also be considered to be more technically correct implementation.

Hope this helps

André

Tags: Database

Similar Questions

  • Comparison of the data of several rows in a table - based on the primary key

    Currently I have a select statement that returns hundreds of records.  Each returned record is linked to A NUMBER of ORDER this order number has a recipe.  (a bit like a cooking recipe).  Each recipe has many records in the database related to this order number and records should be compared to records in a table that bind to a specific primary key...  (I have already developed the logic to isolate what PK I need).  If all these records that are returned by the select statement below does not match all the records containing PK in the table below, I need to get the next PK and compare all these recordings for select statements return.

    See below for a better understanding. Need a good example detailed on how to solve my problem here.

    Just to help you understand:

    Each element of the recipe is 3 parts (side, ref_des, part_number).  1 single recipe can have several parts (where the part_number), and each of these pieces should be placed on the lower side or top of the Board that is there "side" comes into play.  Same thing with Ref_Des.

    What is going on

    Select statement returns the RECIPE of ORDER NUMBER A.  There will be multiple records returned by this query.

    Select the Return statement:

    • Side
    • Ref_Des
    • Part_Number

    Example of return:

    B c17 75145-2

    T f14 89242-8

    B s12 45123-3

    etc,

    In general - what I need to do:

    There is a table called AUTO_RECIPE_DETAILS.  I take all of the records returned by the select query above and compare for each record in this table relating to the recipe 30319-000001.  30319-000001 a number of records.  It is the primary key for a whole recipe as seen above.  This primary key is bound the number of data records in this table.  The comparison is to see if all records under RECIPE_NAME 30319 -000001 match all the records returned by the select statement.

    IF IT DOES NOT MATCH: recover the following recipe in this table below 30319 -000002 and make the same comparison.

    Here's a perfect example of what the table looks like: (AUTO_RECIPE_DETAILS)


    RECIPE_NAME SIDE REF_DES PART_NUM

    -30319-000001 C16 87595-1 B

    -30319-000002           T B14 74150-4

    -30319-000001 T B14 34251-2          

    -30319-000001            T F24 84180-7

    -30319-000002 T B12 13710-8          



    It is the solution to my original question.  By this thread, it's the right answer and I hope this helps someone who is trying to compare two arrays element-by-element.  In the end, the advice given in this thread were correct and I will be using all of your suggestions and the scrapping of this.  Thank you everyone for your help though.

    FOR index_p IN pid_recipe. FIRST... pid_recipe. LAST

    LOOP

    Result WHEN the OUTPUT = 1;

    FOR index_d IN details_recipe. FIRST... details_recipe. LAST

    LOOP

    IF (pid_recipe (index_p). SIDE = details_recipe (index_d). SIDE)

    AND (pid_recipe (index_p). REF_DES = details_recipe (index_d). REF_DES)

    AND (pid_recipe (index_p). PART_NUM = details_recipe (index_d). PART_NUM)

    THEN

    EXIT;

    ON THE OTHER

    DBMS_OUTPUT. Put_line("IT WAS NOT a MATCH");

    result: = 1;

    EXIT;

    END IF;

    END LOOP;

    END LOOP;

    DBMS_OUTPUT. Put_line('LOOP OUT');

  • Order columns (which make up the primary key constraint) matter in where clause of DML query for use of indexing mechanism to operate.

    Version of DB: database Oracle 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production


    I have a table my_table as below:
    create table my_table
    (
    my_code varchar2 (6).
    my_id varchar2 (24).
    forced pk_1 primary key (my_code, my_id)
    );


    Primary_key here's a composite key that contains columns 1 (my_code) and 2 (my_id).
    Is there that a difference in the way below queries is executed in terms of performance (use of indexing in the extraction).

    (a) select * from my_table where my_code = '123' and my_id = "456";
    (b) select * from my_table where my_id = '456' and my_code = '123';


    The understanding I have the order of the column in the where clause should be identical to the sequence in
    What primary key draws for indexing to be used by oracle in oracle other DML queries ignores indexing
    However when I used explain plain both show the same query cost with single scan with index rowid.
    so I don't know if I'm wrong in the concept that I have. Kindly help.

    Thanks in advance,
    Gerard

    Your question is answered in the Performance Tuning Guide

    Using indexes and clusters

    14.1.4 choosing composite indexes

    A composite index contains several key columns. Composite indexes can provide additional benefits compared to the index to single column:

    • Improved selectivity

      Sometimes the two or more columns or expressions, each with a low selectivity can be combined to form a composite with a high selectivity.

    • Reduced IO

      If all columns selected by a query are a composite index, then Oracle may return these values in the index without access to the table.

    A SQL statement can use a path on a composite index if the statement contains constructions that use a main part of the index.

    Note:

    This is no longer the case with the skip index scans. See "Index Skip Scans".

    A main part of an index is a set of one or more columns that have been specified first and consecutively in the list of columns in the CREATE INDEX statement that created the index.

  • by specifying the index tablespace in to disable the primary key constraint

    Hello
    during the ETL I want to disable constraints PK/UK to speed up the load;
    on activation of the constraint, the corresponding indices are created in a different tablespace while they were initially on the creation of the table itself
    I tried to disable PK / UK with the option 'keep the index', the index value corresponding to the status of "unusable" and use ' alter session set skip_unusable_indexes = true', but then I can't insert rows with the error.
    Error: ORA-01502: index 'xxx' or partition of such index is in unusable state
    can anyone tell if there is a way to allow the PK/UK constraint and specify the storage space for the corresponding indices, or keep the index and inserts works?
    I'd like to avoid to drop constraints / indexes and re-create them both from scratch after the load
    Thank you for the advice
    Thank you
    Rgds

    >
    can anyone tell if there is a way to allow the PK/UK constraint and specify the storage space for the corresponding indices, or keep the index and inserts works?
    I'd like to avoid to drop constraints / indexes and re-create them both from scratch after the load
    >
    Have you tried specifying the table space in the USING clause when you activate the constraint?

    ALTER TABLE emp ENABLE PRIMARY KEY USING INDEX TABLESPACE myTS;
    

    See DBA guide
    http://docs.Oracle.com/CD/B28359_01/server.111/b28310/indexes003.htm
    >
    Creating an Index associated with a constraint

    Oracle database applies a UNIQUE key or a constraint integrity PRIMARY KEY on a table by creating a unique index on the unique key or primary key. This index is created automatically by the database when the constraint is enabled. No action is required by you when you run the CREATE TABLE or ALTER TABLE statement to create the index, but you can optionally specify an ESCALATION using clause to exercise control over his creation. This includes them when a constraint is defined and enabled, and when a constraint defined but disabled is selected.
    >
    Note the last sentence two sentences:
    >
    You can optionally specify an ESCALATION using clause to exercise control over his creation. This includes them when a constraint is defined and enabled, and when a constraint defined but disabled is selected.
    >
    You realize, I hope, that the only way can Oracle KNOWS that the index contains valid values is to rebuild?

  • blocking because of the primary key constraint

    Hi all

    Recently, we migrated to 9.2.0.4 to 10.2.0.4. In the new version of oracle there was a strange behavior, we have 200 + oracle database user and there was too much blocking on a particular one table, we looked and looked for the cause but found nothing exact reason, then on the internet somewhere, we found that if a primary key is disabled and no there is also foreign then blocking is caused for example

    CREATE TABLE TEST_MST
    (
    MST_COL1 NUMBER,
    MST_COL2 NUMBER,
    MST_COL3 NUMBER
    )

    CREATE TABLE TEST_DTL
    (
    MST_COL1 NUMBER,
    MST_COL2 NUMBER,
    MST_COL3 NUMBER,
    DTL_COL1 NUMBER,
    DTL_COL2 NUMBER,
    DTL_COL3 NUMBER
    )

    ALTER TABLE TEST_MST ADD)
    CONSTRAINT PK_TM
    KEY ELEMENTARY SCHOOL
    (MST_COL1, MST_COL2, MST_COL3)) ;

    ALTER TABLE TEST_DTL ADD)
    CONSTRAINT PK_TD
    KEY ELEMENTARY SCHOOL
    (MST_COL1, MST_COL2, MST_COL3, DTL_COL1, DTL_COL2)) ;

    ALTER TABLE TEST_DTL ADD)
    CONSTRAINT FK_TM_TD
    FOREIGN KEY (MST_COL1, MST_COL2, MST_COL3)
    REFERENCES TEST_MST (MST_COL1, MST_COL2, MST_COL3));

    ALTER TABLE TEST_DTL
    DISABLE THE CONSTRAINT PK_TD;


    so, I just want to be sure that's the exact reason only blocking sessions and if yes, then why not so happning.

    Thanks and Rgds,
    Piyush
  • Update based on the max value of different tables.

    {code}

    create the table rule_table (number rule_id);

    insert into rule_table values (10);

    insert into rule_table values (20);

    insert into rule_table values (30);

    insert into rule_table values (40);

    create the table auth_table (number of auth_id, rule_id number);

    insert into auth_table values (1000, 10);

    insert into auth_table values (2000, 10);

    insert into auth_table values (3000, 10);

    insert into auth_table values (4000, 20);

    insert into auth_table values (5000, 20);

    insert into auth_table values (6000, 30);

    insert into auth_table values (7000, 30);

    insert into auth_table values (8000, 40);

    insert into auth_table values (9000, 40);

    create the table pay_table (pay_id number, auth_id number, pay_indicator number);

    insert into pay_table values (11111, 1000, 0);

    insert into pay_table values (22222, 1000, 1);

    insert into pay_table values (33333, 1000, 0);

    insert into pay_table values (44444, 2000, 0);

    insert into pay_table values (55555, 2000, 1).

    insert into pay_table values (66666, 2000, 0);

    insert into pay_table values (77777, 3000, 0);

    insert into pay_table values (88888, 3000, 0);

    insert into pay_table values (99999, 4000, 0);

    insert into pay_table values (111111, 4000, 0);

    insert into pay_table values (222222, 5000, 0);

    insert into pay_table values (333333, 5000, 0);

    insert into pay_table values (444444, 6000, 0);

    insert into pay_table values (555555, 7000, 1);

    insert into pay_table values (666666, 8000, 0);

    insert into pay_table values (777777, 9000, 0);

    insert into pay_table values (888888, 9000, 1);

    create the table rule_pay (rule_id number, pay_max_indicator number);

    insert into rule_pay values (10, 0);

    insert into rule_pay (20, 0) values;

    insert into rule_pay (30, 0) values;

    insert into rule_pay (40, 0) values;

    {code}

    My intention is:

    for every find of rule_id on the maximum pay_indicator (tables 3 query to get the max Show pay_indicator below) and on the other table I have to update this value max based on rule_id.

    with max_tab

    as

    (

    Select a.rule_id, max (pay_indicator) pay_indicator

    rule_table a.,

    b auth_table,

    c pay_table

    where a.rule_id = b.rule_id

    and b.auth_id = c.auth_id

    A.rule_id group

    )

    Update rule_pay

    Set pay_max_indicator = (select max_tab.pay_indicator

    of max_tab

    where max_tab.rule_id = rule_pay.rule_id)

    where

    rule_id in (select rule_id from max_tab);

    The above query does not.

    Any help or suggestions are greatly appreciated.

    Something like that?

    SQL > select * from rule_pay;

    RULE_ID PAY_MAX_INDICATOR

    -------------------- --------------------

    10                    0

    20                    0

    30                    0

    40                    0

    SQL > fusion in rule_pay PR

    2. using (select a.rule_id, max (pay_indicator) pay_indicator

    rule_table 3A,

    auth_table 4 b,

    pay_table 5 c

    6 where a.rule_id = b.rule_id

    7 and b.auth_id = c.auth_id

    Group 8 by a.rule_id

    9        ) u

    10 on (u.rule_id = rp.rule_id)

    11 when matched, then update

    12 set rp.pay_max_indicator = u.pay_indicator

    13;

    4 lines merged.

    SQL > select * from rule_pay;

    RULE_ID PAY_MAX_INDICATOR

    -------------------- --------------------

    10                    1

    20                    0

    30                    1

    40                    1

    BTW, you can't put a WITH clause before an update.  It can only precede a select statement.

  • Direct path SQLLDR allows duplicates in the primary key

    I would use sqlldr path direct to charge millions of records in the table but direct way allows duplicates on the primary key constraints.

    inserts of duplicates
    sqlldr control deploy_ctl/deploy_ctl@dba01mdm = direct ctl_test.ctl = true
    primary key is enabled

    I do not understand the behavior that's why the primary key is always enabled--(logiquement il doit avoir désactivé que doublons insérés)

    Inserts no duplicates
    sqlldr control = ctl_test.ctl deploy_ctl/deploy_ctl@dba01mdm
    primary key is enabled

    Please can I know if there is any work around to use direct path with constraints of primary school in place.

    The only solution is to not use direct load, if your dataset contains records in duplicate, of the documentation:

    /*
    A record that violates a UNIQUE constraint is not rejected (the file is not available in the memory when the constraint violation is detected).
    */

  • creating a unique index of instaed of using the primary key index

    Hello

    I heard in a debate sometimes it is better to create a unique index on a column and use it instead of using the primary key index in oracle. I did not understand what that the reason propely.

    Can someone please help me in this topic if it is valid.

    Thanks in advance

    On the surface, which does not seem reasonable... Volume of the DML is irrelevent to determine which column is the primary key for a table.

    My wild speculation a bit at a reasonable time could someone do...

    If you use synthetic primary keys (i.e. the keys generated by sequence) and that your tables are subject to large volumes of inserts such as there is a danger that the block "to the right" will be the source of contention block and worry not about analysis of beach on the column, you can create a reverse on this column (unique or non-unique) key index before creating the primary key constraint and to indicate Oracle to use this existing index to respect the primary key constraint.

    Obviously, however, this involves a lot of assumptions to arrive at a reasonable point. There may well be another set of assumptions that could also lead to a valid argument. Or it could be a myth that someone has heard and just repeats.

    Justin

  • Automatically fill the primary key

    We have Oracle database 10g. I've added a primary key column to my deo_language_resources_t of table with the following logic:

    -- 1. create sequences
    create sequences eod_lr_seq
    Start increment by 10 by 5
    MinValue 10 nomaxvalue
    NoCache;

    -- 2. Create the primary key column
    ALTER table deo_language_resources_t
    ADD NUMBER RESOURCE_ID;

    -- 3. Fill the pk
    Update deo_language_resources_t
    Set id_ressource = eod_lr_seq.nextval
    where id_ressource is null;

    -- 3. Create the primary key constraint
    ALTER table deo_language_resources_t
    Add constraint resource_id_pk key (resource_id) primary;

    insert into deo_language_resources_t
    (first_name, last_name, id_ressource)
    values ('John', 'Doe', eod_lr_seq.nextval);

    The last INSERT statement successfully a line inserted into the table and populated by id_ressource with the next number in the sequence eod_lr_seq. Ok.

    Is it possible to set a constraint on deo_language_resource_t so that when I INSERT a line the id_ressource is automatically set to eod_lr_seq.nextval? It is possible to define a trigger and resembling the logic of the trigger? The insert statement would be like:

    INSERT INTO deo_language_resources_t (first_name, last_name) VALUES ('John', 'Doe');
    create trigger deo_language_resources_trigger
    before insert on deo_language_resources_t
    for each row
    begin
    select eod_lr_seq.nextval into :resource_id from dual;
    end;
    
  • Create the primary key on the target

    Y at - it no IKM which would create the primary key on target after having read the instructions for the source?

    Thank you
    Dinesh.

    Hi Dinesh,

    You can customize a KM to create a primary key on the target
    The target table will be created with the mention of the primary key constraint in the data target store.

    Steps: -.

    Customiuse creating target step of the table and I create $ step table.

    for example: -.

    original train target table KM walk (IKM Oracle Simple incremental update): -.

    create table< %="snpRef.getTable" ("l",="" "a",="" "targ_name")="" %="">
    (
         <%=snpRef.getTargetColList("", "[COL_NAME]\t[DEST_CRE_DT] NULL", ",\n\t", "")%>
    )

    custom STAGE: -.

    create table< %="snpRef.getTable" ("l",="" "a",="" "targ_name")="" %="">
    (
         <%=snpRef.getTargetColList("", "[COL_NAME]\t[DEST_CRE_DT] NULL", ",\n\t", "")%>

    CONSTRAINT constraint_name PRIMARY KEY (< %="snpRef.getColList" ("",="" "[column]",="" ",",="" "",="" "pk")="" %="">)
    )

    Note:- The code above described here is just a sample of reference. I did not test the syntax.

    Kind regards
    Its

  • primary key constraint...

    Hi all

    I have a table 'employees' on 'hr' scheme, now, I created a user 'rahul' on the same database and pulling a request by logging in with the user "rahul" which is:

    create table rahul.employees
    as (select * from hr.employees); -ps: I have the privilege to read data from hr.employees

    Now, the above query works fine, the only issue is that employe_id is the primary key for the table hr.employees and when I check the table of rahul.employees, the pruimary key constraint is missing, however the structure of the table and the data is there according to my expectations.

    I so want to know how to create a table with data using the definition of schema_name.table_name as well as the primary key constraint.

    Concerning
    Rahul karou

    Mac_Freak_Rahul wrote:
    Thanks for the reply, but this query returns me nothing, is it a question of privilege?

    Concerning
    Rahul

    Are you an error? Otherwise, the result will be CLOB, just copy from your clint tool and paste it into a Notepad...

    between it's table

    CREATE TABLE "HR"."EMPLOYEES1"
       (     "EMPLOYEE_ID" NUMBER(6,0),
         "FIRST_NAME" VARCHAR2(20),
         "LAST_NAME" VARCHAR2(25) CONSTRAINT "EMP_LAST_NAME_NN" NOT NULL ENABLE,
         "EMAIL" VARCHAR2(25) CONSTRAINT "EMP_EMAIL_NN" NOT NULL ENABLE,
         "PHONE_NUMBER" VARCHAR2(20),
         "HIRE_DATE" DATE CONSTRAINT "EMP_HIRE_DATE_NN" NOT NULL ENABLE,
         "JOB_ID" VARCHAR2(10) CONSTRAINT "EMP_JOB_NN" NOT NULL ENABLE,
         "SALARY" NUMBER(8,2),
         "COMMISSION_PCT" NUMBER(2,2),
         "MANAGER_ID" NUMBER(6,0),
         "DEPARTMENT_ID" NUMBER(4,0),
          CONSTRAINT "EMP_SALARY_MIN" CHECK (salary > 0) ENABLE,
          CONSTRAINT "EMP_EMAIL_UK" UNIQUE ("EMAIL")
      USING INDEX  ENABLE,
          CONSTRAINT "EMP_EMP_ID_PK" PRIMARY KEY ("EMPLOYEE_ID")
      USING INDEX ENABLE,
          CONSTRAINT "EMP_MANAGER_FK" FOREIGN KEY ("MANAGER_ID")
           REFERENCES "HR"."EMPLOYEES" ("EMPLOYEE_ID") ENABLE,
          CONSTRAINT "EMP_JOB_FK" FOREIGN KEY ("JOB_ID")
           REFERENCES "HR"."JOBS" ("JOB_ID") ENABLE,
          CONSTRAINT "EMP_DEPT_FK" FOREIGN KEY ("DEPARTMENT_ID")
           REFERENCES "HR"."DEPARTMENTS" ("DEPARTMENT_ID") ENABLE
       ) 
    
  • modify a primary key constraint

    Hello

    I start with oracle, and I have two doubts which cannot handle after a search on the internet.

    1. it is possible to do an ALTER TABLE for a DEFAULT CONSTRAINT?. Maybe you think that the question should be in a different way like this: oracle database takes the default condition as a constraint?. As far as I know, not done that.

    2. it is possible, with an ALTER TABLE to CHANGE a CONSTRAINT of a PRIMARY KEY, to add another field more?

    I searched the internet, but I have not found a clear answer. I use oracle 10g express edition.


    Thank you very much.

    P.D.:sorry for my English, it is not very good.

    #2-you can not 'add a column to the primary key of a table constraint' with a single ALTER, but you can delete and re-create the constraint primary key (including the additional column).

    13:25:26> create table t1 (a number primary key, b number, c number );
    
    Table created.
    
    Elapsed: 00:00:00.09
    13:25:46> alter table t1 drop primary key;
    
    Table altered.
    
    Elapsed: 00:00:00.06
    13:25:47> alter table t1 add primary key (a,b);
    
    Table altered.
    
    Elapsed: 00:00:00.09
    

    But you will not be able to drop the primary key of a table index.

    13:25:47> create table t2 (a number primary key, b number, c number ) organization index;
    
    Table created.
    
    Elapsed: 00:00:00.03
    13:25:59> alter table t2 drop primary key;
    alter table t2 drop primary key
    *
    ERROR at line 1:
    ORA-25188: cannot drop/disable/defer the primary key constraint for
    index-organized tables or sorted hash cluster
    
    Elapsed: 00:00:00.00
    13:25:59> 
    

    #1-I'm not sure I understand your question, but you can change a table column to have a default value. This isn't a "constraint", but a default value. It has an effect when you perform an insert which does not include this column.

    13:31:23> alter table t1 modify (c default 3.14);
    
    Table altered.
    
    Elapsed: 00:00:00.04
    13:31:24> insert into t1 (a,b,c) values (1,2,3);
    
    1 row created.
    
    Elapsed: 00:00:00.01
    13:31:24> insert into t1 (a,b,c) values (4,5,NULL);
    
    1 row created.
    
    Elapsed: 00:00:00.00
    13:31:24> insert into t1 (a,b) values(6,7);
    
    1 row created.
    
    Elapsed: 00:00:00.01
    13:31:24> select * from t1;
    
             A          B          C
    ---------- ---------- ----------
             1          2          3
             4          5
             6          7       3.14
    
    3 rows selected.
    
    Elapsed: 00:00:00.18
    
  • Get the primary key of entry just created by submitting the form

    Hi guys,.

    I have a form built in APEX based on a table. The PK is generated by the sequence and the values of the form are recorded by DML (insert).

    Do I have to do is once I have create a new entry with my, I need to update a whole bunch of other tables with the new PK that I can easily do this by creating a process of PL/SQL after DML.



    However, I need the primary key generated by the new entry (created by filling out the form + submit).

    One way around it is
    Select max(userid) from user
    to retrieve it, but I don't know if it's a good idea/practice.

    Any idea guys? See you soon.

    Taepodong wrote:
    Hi guys,.

    I have a form built in APEX based on a table. The PK is generated by the sequence and the values of the form are recorded by DML (insert).

    Do I have to do is once I have create a new entry with my, I need to update a whole bunch of other tables with the new PK that I can easily do this by creating a process of PL/SQL after DML.

    However, I need the primary key generated by the new entry (created by filling out the form + submit).

    One way around it is

    Select max(userid) from user
    

    to retrieve it, but I don't know if it's a good idea/practice.

    This will only give the maximum ID and not currently generated ID

    Any idea guys? See you soon.

    Use this feature APEX
    Change your page > change you the DTF process for the form > Enter you page back key point in the element (this returns the new pk value generated by this form)

  • Too many objects correspond to the primary key oracle.jbo.Key

    I get this error: Too many objects match the primary key oracle.jbo.Key when I tried to look for in a display object where the primary key is consists of more than one filed.

    Use case:

    In Jdeveloper 11.1.2.3 I Entity object called someTable this table has three fields A,B and C where the primary key is consist class towing A and B .

    I created different towing View object of someTable object enity that are someTableVO1 and someTableVO2 . Rated A in the view object somtableVO1 is a List Of Value(LOV) and the data are coming form filed A in the someTableVO2 .

    In application I have a search page that contains a drop-down list of registered A in somTableVO1 . Based on certain conditions, the drop-down list of the values in the list is not static. The value of the drop-down list is editable based on a select query run on someTableVO1 and it is based on the class thried C is NOT part of the primary key .

    The page displays the drop down menu with the correct values. But I have a ValeChangeListener method that will be activated whenever the user selects a value form the drop-down list.

    The problem is:

    The error Too many objects match the primary key is occur whenever I am executing this method.

    Support:

    I think the problem is with multiple fields for the primary key. of curse, there is an overlap in a part of the primary key (IE that paid A or B ) but the combination of A and B are always unique.

    Notes:

    1. I check the query by executing SQL Developer and it shows not all duplicate values.

    2 I don't attach code, because I think that the problem is not on (how to) this is (what to do).

    I hope that the idea is clear

    Problem solved.

    My goal was to show a summer that A form someTableVO1 as a list of value and I was trying to achieve by creating the list of value the same form Entity object . I understand that it was the wrong approach (correct me if I'm wrong). to achieve this in ADF technology, I have to do the following:

    1. Simply to drag and drop the view object from the Data Controls page.
    2. List of options appears asking how you want to display the view object (shape, chart, table, only one selection,...).

    3. Select Single Selection ->ADF one Selection

    4. Select the attributes that you want to show the user a list of values.

    Thanks for your comments.

  • implement the primary key on the field of forms

    Hello experts,

    I have a form with deptno single base table.
    dept_name and deptno. DEPTNO is a primary key in the database table.
    When I get the records, it prevents to insert the value that is duplicated in the deptno text box when I insert or update.

    the form I create a block with the base table, apply the primary key property of this Dept block. is Yes.
    then I put the key property primary deptno fields to yes.
    When I get duplicate records and then save, it prevents insertion but I want the following:

    I run the form, when I enter the first record, if it exists in the table can prevent to insert. also after the first record was inserted.
    If I insert to new deptno even into the next record, it must also prevent.

    Please help me.

    Thank you
    Yoann

    You have built your data forms to help block the "data block Wizard? If so, it already identified DEPTNO as the PK column. If it does not, or you have built your data manually block, you can open the palette property for the DEPTNO element and set the primary key property Yes. When this property is set on an element, the corresponding property of block, primary to apply key must also be set to yes. Please remember, however, that the Act of mark the DEPTNO as a PK does not 'Real time' checking for duplicates. Checking for duplicates occur when validation occurs. If you need a real-time duplicate check, you will need to write code to allow audits in double 'real time '.

    There are numrous examples in the forum to check duplicate in real-time as well as examples on the Internet. A search on Google for 'Check' the locker double shaped will give you lots of good examples.

    Craig...

Maybe you are looking for

  • macOS Sierra is a buggy and crap OS

    The worst OS that apple has ever made. Model of MacBook Pro (Early 2015) is not close properly without a hard stop, after the installation of macOS Sierra. Still, it shows a window saying that there is a problem in my MacBook and should be stopped. W

  • No dialog "approve this computer."

    Since the 10 update on my 5s iPhone iOS, I have the opposite problem of the loop of 'trust' that many have, in my case, whenever I want to import photos in the Photos app, it says, please press the dialog box "approve this computer" on the iPhone, bu

  • iTunes 12.5.1 Massive view artist?

    Since the update that the size of the Album cover and the massive obtained text in view of the artist, is there a way to reduce this back to its small original size?

  • use several fixes for live

    Hello; Sorry if this is a stupid question, but we'll have our first live concert in 2 weeks and I need some information. an instrumental songs is running in the background (desktop dj) and we want to add some live and vocal instruments using the main

  • Accidentally, I put my Macbook not in the stream with other devices

    It is a real irritable and I hope that someone can help you. I've had my Macbook Pro for about 4 years now but had never used icloud.  When I decided to start doing so yesterday I went in iCloud in settings and seen something like: "Do not allow for