2 Primary Keys to 1 Foreign Key

Can I connect 2 different Primary Key to 1 foreign Key as mentioned in Scenario 1? Is this a good design?
Else suggest me which among the following scenarios hold good.
Scenario 1:
Global Employee (Global Employee ID)
Local Employee (Local Employee ID)
Dept_Global_Local Employee_Map (Employee ID, Global_Local Employee ID)Scenario 2:
Global Employee (Global Employee ID)
Local Employee (Local Employee ID)
Dept_Global_Local Employee_Map (Employee ID, Global Employee ID, Local Employee ID)Scenario 3:
Global Employee (Global Employee ID)
Local Employee (Local Employee ID)
Dept_Global_Employee_Map (Employee ID, Global Employee ID)
Dept_Local_Employee_Map (Employee ID, Local Employee ID)

A foreign key in child table refers Primary OR Unique key in Parent table.
If you are defining 1 foreign key to 2 primary keys (of 2 different tables), there might be a chance of 1 to 1 relationship between 2 parent tables. So, defining 1 to 1 relationship among parent table is a good idea.
Even though defining 1 FK to 2 PKs not possible in Oracle, defining such constraints is not suggestable in any OLTP DBs.

Similar Messages

  • PRIMARY KEY(MASTER)를 REFERENCE하는 FOREIGN KEY 찾는 SQL

    제품 : ORACLE SERVER
    작성날짜 : 2004-03-12
    PRIMARY KEY(MASTER)를 REFERENCE하는 FOREIGN KEY 찾는 SQL
    ========================================================
    $sqlplus sys/manager(SYS user 로 login 함)
    sql> select c.name constraint_name
    from dba_objects a,
    cdef$ b,
    con$ c
    where a.object_name = 'TABLE_NAME'
    and a.object_id = b.robj#
    and b.con# = c.con#
    /

    Hello again,
    May be I was not clear enough.
    Scenario 1: We use the master-detail form as is with the default oolbar. In this case, the user can insert the detail records one by one without needing the primary-foreign key value since this is handled by default.
    Once we save the form (commit_form), I use the pre-insert trigger to get the master block primary key generated from the sequence and since the detail block key is copied from this value, both are saved correctly and it is the end of the story.
    Scenario 2: As explained in the initial post, the user will populate the detail records one by one by clicking on the -INSERT DETAIL- button and hence has a window where he can insert the detail info and then be brought back to the master-detail form every time he enters a new detail record.
    The problem here is that I can't generate the primary key for the master block since the client has the following requirement:
    The user can always change his mind and not complete, meaning save the form, his process
    As such, the key should be generated in the last step before Commit.

  • Drop foreign keys and recreate foreign keys with on delete cascade dymanica

    I need to drop foreign keys and recreate foreign keys with on delete cascade dymanically via a script. Does anyone have a script available?

    You could also disable the integrity contraints.
    SET PAGESIZE 0
    SET FEEDBACK OFF
    SET PAUSE OFF
    -- create a disable script
    SPOOL do_disable.sql
    SELECT 'ALTER TABLE '
           || table_name
            || chr(10) ||
           'DISABLE CONSTRAINT '
            || constraint_name
            || ';'
      FROM user_constraints
    WHERE constraint_type = 'R'
       AND status = 'ENABLED'
    select 'alter trigger '
           || trigger_name
            || ' disable;'
      from user_triggers
    where status = 'ENABLED'
    SPOOL OFF
    -- now create a enable script as well
    SPOOL do_enable.sql
    SELECT 'ALTER TABLE '
           || table_name
            || chr(10)
            || 'ENABLE CONSTRAINT '
            || constraint_name
            || ';'
      FROM user_constraints
    WHERE constraint_type = 'R'
       AND status = 'ENABLED'
    SELECT 'ALTER trigger '
           || trigger_name
            || ' ENABLE;'
      FROM user_triggers
    WHERE status = 'ENABLED'
    SPOOL OFF
    SET FEEDBACK ONif you run this script on a TESTdatabase you will end up with a do_disable.sql and a do_enable.sql script on youre local directory.
    Running do disable will disable all the currently enabled triggers and contraints.
    Running do_enable.sql will enable the previously disables triggers and contraints.
    be sure to test before executing this on a real live production database.
    Make sure you have a good backup!

  • Does a foreign key have to be a primary key

    Hey all.I was checking on the database code written by sambapos.To my surprise, I found a foreign key that is not a primary key anywhere.
    Is that possible?
    If, so why?
    I am really astonished.

    Limitations and Restrictions
    A foreign key constraint does not have to be linked only to a primary key constraint in another table; it can also be defined to reference the columns of a UNIQUE constraint in another table.
    When a value other than NULL is entered into the column of a FOREIGN KEY constraint, the value must exist in the referenced column; otherwise, a foreign key violation error message is returned. To make sure that all values of a composite foreign key constraint
    are verified, specify NOT NULL on all the participating columns.
    FOREIGN KEY constraints can reference only tables within the same database on the same server. Cross-database referential integrity must be implemented through triggers. For more information, see
    CREATE TRIGGER (Transact-SQL).
    FOREIGN KEY constraints can reference another column in the same table. This is referred to as a self-reference.
    A FOREIGN KEY constraint specified at the column level can list only one reference column. This column must have the same data type as the column on which the constraint is defined.
    A FOREIGN KEY constraint specified at the table level must have the same number of reference columns as the number of columns in the constraint column list. The data type of each reference column must also be the same as the corresponding column in the column
    list.
    The Database Engine does not have a predefined limit on either the number of FOREIGN KEY constraints a table can contain that reference other tables, or the number of FOREIGN KEY constraints that are owned by other tables that reference a specific table.
    Nevertheless, the actual number of FOREIGN KEY constraints that can be used is limited by the hardware configuration and by the design of the database and application. We recommend that a table contain no more than 253 FOREIGN KEY constraints, and that it
    be referenced by no more than 253 FOREIGN KEY constraints.
    FOREIGN KEY constraints are not enforced on temporary tables.
    If a foreign key is defined on a CLR user-defined type column, the implementation of the type must support binary ordering. For more information, see
    CLR User-Defined Types.
    A column of type varchar(max) can participate in a FOREIGN KEY constraint only if the primary key it references is also defined as type
    varchar(max).
    Read this article
    http://msdn.microsoft.com/en-us/library/ms189049.aspx
    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

  • Composite primary key as foreign key not working

    i want have two tables
    in one table i make a composite primary key
    and in the other table i refer one of the column of the composite key from the above table as foreign key in this table but this didn't work.
    eg:
    create table temp1
    ( name char2(10),
    ssn# number(10)
    address varchar2(10)
    constraint (cons_1)primary key(name,ssn#) );
    create table temp2
    ( name1 char2(10) references temp1(name),
    add varchar(20));
    this didn't work....can't create temp2 table it's giving error

    The following includes some corrections and some suggestions. Your original code had several problems: missing comma, invalid name, invalid data type, no unique key for the foreign key to reference. The following fixes all of those and adds some meaningful names for the constraints and formats it so that it is easier to read.
    CREATE TABLE temp1
      (name       VARCHAR2 (10),
       ssn#       NUMBER   (10),
       address    VARCHAR2 (10),
       CONSTRAINT temp1_name_ssn#_pk
                  PRIMARY KEY (name, ssn#),
       CONSTRAINT temp1_name_uk
                  UNIQUE (name))
    Table created.
    CREATE TABLE temp2
      (name1      VARCHAR2 (10),
       address    VARCHAR2 (20),
       CONSTRAINT temp2_name1_fk
                  FOREIGN KEY (name1)
                  REFERENCES temp1 (name))
    Table created.

  • Questions about creating a foreign key on a large table

    Hello @ll,
    during a database update I lost a foreign key between two tables. The tables are called werteart and werteartarchiv_pt. Because of its size, werteartarchiv_pt is a partitioned table. The missing foreign key was a constraint on table werteartarchiv_pt referencing werteart.
    Some statistics about the sizes of the mentioned tables:
    werteart 22 MB
    werteartarchiv_pt 223 GB
    werteartarchiv_pt (Index) 243 GB
    I tried to create the foreign key again, but it failed with the following error (Excuses for the german error message):
    sqlplus ORA-00604: Fehler auf rekursiver SQL-Ebene 1
    sqlplus ORA-01652: Temp-Segment kann nicht um 128 in Tablespace TEMPS00 erweitert
    The statement I used:
    alter table werteartarchiv_pt
    add constraint werteartarchiv_pt_fk1
    foreign key (schiene, werteartadresse, merkmale)
    references werteart (schiene, werteartadresse, merkmale)
    on delete cascade
    initially deferred deferrable;
    So the problem seems to be, that Oracle needs a lot of temporary tablespace to generate the foreign key and I do not know how much and why.
    My questions now are, and hopefully someone is here, who can answer all or a part of it:
    1) Why does Oracle need temporary tablespace to create the foreign key? The foreign key uses the same columns like the primary key.
    2a) Is it possible to tweak the statement without using the temporary tablespace?
    2b) If it is not possible to avoid the usage of the temporary tablespace, is there a formula how to calculate the needed temporary tablespace?
    3) Is it possible to modify data in the tables while the foreign key is created or is the whole table locked during the process?
    Any help or hint is appreciated.
    Regards,
    Bjoern

    RollinHand wrote:
    My questions now are, and hopefully someone is here, who can answer all or a part of it:
    1) Why does Oracle need temporary tablespace to create the foreign key? The foreign key uses the same columns like the primary key.Because it's validating the data to ensure the foreign key won't be violated. If you had specified ENABLE NOVALIDATE when creating it then the existing data in the table wouldn't need to be checked and the statement should complete instantly (future data added would be checked by the constraint).
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/general005.htm
    Search for "Enable Novalidate Constraint State"

  • Use of Foreign Keys in MDM

    Hi All,
    Is there any mean by which we can use Foreign Keys in MDM.
    Sighting an example.
    We have 3 table with fields:
    Products(Main Table): Material No( UF)
    Product Regions(Flat): Marerial No ( Foreign Key),Region: Lookup
    Prices(Flat): Material No( Foreign Key),Region: Lookup(Foreign Key),Price Type: Lookup.
    How is it possible to achieve the above mentioned scenerio.
    And are Foreign Keys same as Unique Fields in MDM. 
    Thanks
    Manish
    Edited by: manish gupta on Mar 4, 2009 12:30 PM

    Hi Manish,
    MDM server sits on the database server.
    The database server is a DBMS.MDM repository does not work with the tables and fields structure in exactly the same way as an RDBMS.
    So we do not use in the real sense the same Primary key Unique key concept.However we have the linkup/lookup field concept in MDM.
    Where a field in the main table can reference another field in the lookup table.
    So if you relate this to the RDBMS concept.The primary field in one table is the Foriegn key in another table.So in the lookup table we can refer a field of the main table.
    say for eg:
    You have a field Regions in the main table of type lookup flat.
    This field is actually used in the lookup flat table say lookup regions.
    This table has a field regions which is holding a legal set of values.
    So the field Regions in main table is used in the Lookup table as well.Where in the main table it was the linking field and in the lookup table it is the field holding the lookup values.
    So you can to an extent relate these 2 concepts but it does not precisily work in the same way in MDM.
    Hope It Helped
    Thanks & Regards
    Simona Pinto

  • SQL data modeller -- how to create 1 to 1 relationship foreign key ?

    hi guys...
    i got 2 tables..
    table 1 - CFR
    CFR_ID = primary key
    table 2 - USER_PLAN
    USER_ID = primary key
    PLAN_ID,
    CFR_ID = foreign key reference (table 1)
    The business flows go like this..
    insdie CFR table, it contain all records / transactions of a particular user/plan. everytime a new transaction occurs for a plan/user, a new CFR_ID / row will be generated.
    after which, the newly generated CFR_ID for the new row , will be updated to the CFR_ID in USER_PLAN
    Thus, there is always a 1 to 1 relationship between the 2 table regardless how many CFR_ID is generated for a particular USER_PLAN. as the CFR_ID in the USEr_plan table will always be the latest one generated inside the CFR table.
    However, in the data modeller, i am unable to create such foreign key relationship... ANY idea how do i create a 1 on 1 foreign key relationship ? or there is no such way..
    Thanks and Best Regards,
    Noob

    Hi philips,
    Thanks for the wonderful reply..
    Just to double comfirm with you,
    even if i had set a unique constraint on CFR_ID(foreign key column), inside the relationship model, the relationship between the foreign key is still showing as a 1:m relationship right ?
    just that a character 'U' will appear beside the CFR_ID column.
    However the diagraphm is still showing a 1:M relationship.
    is this correct ?
    Regards,
    Noob

  • Drop partition without disabling foreign key

    Hi All,
    I have parent and child table.
    Parent table
    create table parent_1
    (id number,
    create_date date,
    constraint parent_1_pk001 PRIMARY KEY (id))
    PARTITION BY RANGE (create_date)
    INTERVAL (NUMTODSINTERVAL(1,'DAY'))
    (PARTITION parent_1_part VALUES LESS THAN ('01-JAN-2010'));
    Child Table
    create table child_1
    (id number,
    create_date date,
    constraint child_1_fk001 FOREIGN KEY (id)
    REFERENCES parent_1 (id))
    PARTITION BY RANGE (create_date)
    INTERVAL (NUMTODSINTERVAL(1,'DAY'))
    (PARTITION create_date_part VALUES LESS THAN ('01-JAN-2010'));
    I am having problems dropping partition.
    Parent_1
    1     26-JUL-12
    2     26-JUL-12
    Child_1
    1     26-JUL-12
    alter table CHILD_1 drop partition SYS_P274;
    table CHILD_1 altered.
    ON DROPPING PARENT PARTITION
    alter table parent_1 drop partition SYS_P273;
    Error report:
    SQL Error: ORA-02266: unique/primary keys in table referenced by enabled foreign keys
    02266. 00000 - "unique/primary keys in table referenced by enabled foreign keys"
    *Cause:    An attempt was made to truncate a table with unique or
    primary keys referenced by foreign keys enabled in another table.
    Other operations not allowed are dropping/truncating a partition of a
    partitioned table or an ALTER TABLE EXCHANGE PARTITION.
    *Action:   Before performing the above operations the table, disable the
    foreign key constraints in other tables. You can see what
    constraints are referencing a table by issuing the following
    command:
    SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME = "tabnam";
    PLEASE CAN I KNOW IF THERE IS ANY WAY TO DROP PARENT PARTITION WITHOUT DISABLE/ENABLE FOREIGN CONSTRAINTS
    Thanks

    SQL Error: ORA-02266: unique/primary keys in table referenced by enabled foreign keys
    02266. 00000 - "unique/primary keys in table referenced by enabled foreign keys"
    *Cause: An attempt was made to truncate a table with unique or
    primary keys referenced by foreign keys enabled in another table.
    Other operations not allowed are dropping/truncating a partition of a
    partitioned table or an ALTER TABLE EXCHANGE PARTITION.
    *Action: Before performing the above operations the table, disable the
    foreign key constraints in other tables. You can't do that until you disable the foreign key constraint
    http://jonathanlewis.wordpress.com/2006/12/10/drop-parent-partition/
    Hope this helps
    Mohamed Houri
    www.hourim.wordpress.com

  • Check constraint/foreign key combination

    I would like to add a constraint (check, FK, or otherwise) that forces a value to be either -1 OR be in a foreign table.  The statement below is invalid because you can't use subqueries, but I think it's clear what I'm trying to do.  Can anyone
    suggest a different approach?
    Thanks!
    ALTER TABLE cfg.ClientFieldThreshold ADD CONSTRAINT CK_cfg_ClientFieldThreshold_DBListID
    CHECK (DBListID = -1 OR DBListID IN (SELECT ID FROM dbo.vwClientDatabases)
    /* the subquery here isn't allowed */

    3 ways to do this. 
    1) use NULL instead of -1 as the value that does not have to be in the foreign table.  Then you just need a normal foreign key (because a foreign key column that contains NULL is not checked against the foreign table.  Sample code to do this
    Create Table FooParent(ParentID int primary key);
    Create Table FooChild(ChildId int primary key, ParentID int Null, Constraint FooChildFK Foreign Key(ParentID) References FooParent);
    go
    -- Can add row with NULL
    Insert FooChild(ChildId, ParentID) Values (1, Null);
    go
    -- But cannot add row with any other value that is not in FooParent
    Insert FooChild(ChildId, ParentID) Values (2, 25);
    go
    -- Check result
    Select * From FooChild;
    go
    Drop Table FooChild;
    go
    Drop Table FooParent;
    2) Add a dummy row to the parent table with a primary key of -1.  Then, of course, all you need is a foreign key constraint.
    3) Add a persisted computed column that is NULL whenever your column that you want to enforce the constraint against is equal to -1, otherwise just the value in that column.  Then create a foreign key on the computed column.  Sample code
    Create Table FooParent(ParentID int primary key);
    Create Table FooChild(ChildId int primary key, ParentID int Not Null, AlteredParentID As NULLIF(ParentID, -1) Persisted, Constraint FooChildFK Foreign Key(AlteredParentID) References FooParent);
    go
    -- Can add row with -1
    Insert FooChild(ChildId, ParentID) Values (1, -1);
    go
    -- But cannot add row with any other value that is not in FooParent
    Insert FooChild(ChildId, ParentID) Values (2, 25);
    go
    -- Check result
    Select * From FooChild;
    go
    Drop Table FooChild;
    go
    Drop Table FooParent;
    Tom

  • How we relate two tables using foreign key(fk)?

    hi to all,
        what are the conditions has to follow to relate two tables.I.e.,
    the two tables have same primary keys(pk). if we relate these two tables in one table the pk and fk will be the same then how that table in active.

    Hi
    To relate two tables..we have foreign key relationship.
    In one table v have primary key and in the second table, the same key is foreign key for that table..
    To relate two tables, we can use JOINS
    If there is already a suitable foreign key between two tables used in the view, these tables can be linked with a join condition from this foreign key.
    Create a view on tables TAB1 and TAB2. TAB1 is the primary table of the view. TAB2 is the secondary table of the view. TAB1 is the check table for TAB2. The foreign key fields are assigned to the check table fields as follows:
    TAB1-FIELD_A assigned to TAB2-FIELD_1
    TAB1-FIELD_A assigned to TAB2-FIELD_1
    The join condition of the view generated from the foreign key is then:
    CREATE VIEW ... AS SELECT ... WHERE TAB2-FIELD_1 = TAB1-FIELD_A AND TAB2-FIELD_2 = TAB1-FIELD_B.
    Join conditions can also be copied from generic and constant foreign keys. If a constant is assigned to a field in the foreign key, it is also assigned to the field in the join condition. There is no join condition for a generic relationship in the foreign key.
    The foreign key between tables TAB1 (check table) and TAB2 (foreign key table) is defined as follows:
    TAB1-FIELD_A assigned to TAB2-FIELD_1
    TAB1-FIELD_B generic
    TAB1-FIELD_C assigned to constant ‘C’
    The join condition for the view generated from the foreign key is in this case:
    CREATE VIEW ... AS SELECT ... WHERE TAB2-FIELD_1 = TAB1-FIELD_A AND TAB2-FIELD_2 = ‘C’.
    Hope it helps
    Reward if useful.

  • How to insert value for composed foreign key?

    My problem when I update or insert to table Ffclient which has link 1-1 with other table ClientLoan by composes primary key loanId and clienId (break table). I auto mapping by Jdeveloper 10g version 10.1.2. In FfClient table has two fields compose foreign key of ClientLoan as loanId and clienId not nullable. In toplink object Ffclient it only has one reference ClientLoan object by clientLoan field, not has two fields loanId and clienId . When I insert or update to database, I can't set value for these two fields direct so I have created new ClientLoan object and set value for composed primary key loanId and clienId, after that set it to object Ffclient. But when I update or insert to database it occurs exception about insert null for two not nullable fields: loanId and clienId.
    Any one has error as mime? Any one help me correct my error.
    Thanks in advance.
    Mapping is:
    ….
    <database-mapping>
    <attribute-name>ffclientCollection</attribute-name>
    <read-only>false</read-only>
    <get-method-name>getFfclientCollection</get-method-name>
    <set-method-name>setFfclientCollection</set-method-name>
    <reference-class>uk.co.lsb.elb.toplink.Ffclient</reference-class>
    <relationship-partner-attribute-name>clientLoan</relationship-partner-attribute-name>
    <is-private-owned>false</is-private-owned>
    <uses-batch-reading>false</uses-batch-reading>
    <indirection-policy>
    <mapping-indirection-policy>
    <type>oracle.toplink.internal.indirection.TransparentIndirectionPolicy</type>
    </mapping-indirection-policy>
    </indirection-policy>
    <container-policy>
    <mapping-container-policy>
    <container-class>oracle.toplink.indirection.IndirectList</container-class>
    <type>oracle.toplink.internal.queryframework.ListContainerPolicy</type>
    </mapping-container-policy>
    </container-policy>
    <source-key-fields>
    <field>LSB.CLIENT_LOAN.CLIENT_ID</field>
    <field>LSB.CLIENT_LOAN.LOAN_ID</field>
    </source-key-fields>
    <target-foreign-key-fields>
    <field>LSB.FFCLIENT.CLIENT_ID</field>
    <field>LSB.FFCLIENT.LOAN_ID</field>
    </target-foreign-key-fields>
    <type>oracle.toplink.mappings.OneToManyMapping</type>
    </database-mapping>
    …..
    <database-mapping>
    <attribute-name>clientLoan</attribute-name>
    <read-only>false</read-only>
    <reference-class>uk.co.lsb.elb.toplink.ClientLoan</reference-class>
    <relationship-partner-attribute-name>ffclientCollection</relationship-partner-attribute-name>
    <is-private-owned>false</is-private-owned>
    <uses-batch-reading>false</uses-batch-reading>
    <indirection-policy>
    <mapping-indirection-policy>
    <type>oracle.toplink.internal.indirection.BasicIndirectionPolicy</type>
    </mapping-indirection-policy>
    </indirection-policy>
    <uses-joining>false</uses-joining>
    <foreign-key-fields>
    <field>LSB.FFCLIENT.CLIENT_ID</field>
    <field>LSB.FFCLIENT.LOAN_ID</field>
    </foreign-key-fields>
    <source-to-target-key-field-associations>
    <association>
    <association-key>LSB.FFCLIENT.LOAN_ID</association-key>
    <association-value>LSB.CLIENT_LOAN.LOAN_ID</association-value>
    </association>
    <association>
    <association-key>LSB.FFCLIENT.CLIENT_ID</association-key>
    <association-value>LSB.CLIENT_LOAN.CLIENT_ID</association-value>
    </association>
    </source-to-target-key-field-associations>
    <type>oracle.toplink.mappings.OneToOneMapping</type>
    </database-mapping>

    Yes, many thanks for you reply.
    My project has many layer (include DAO + EJB + BO + WEB).
    Toplink objects which are auto created by TopLink has only using in DAO and EJB layer, then toplink objects are transfer to Bean objects (valueObject) which are contain primitive java type as int, long, double... not java wrapper object as Integer, Long, Double... Bean objects are using from EJB to WEB layer. So when set value to bean object from toplink object I sometime don't set all reference toplink object to reference object of bean (although bean has references bean object as toplink object) because there are too big. So when I update data from WEB layer to EJB layer, before update to database, I must get fill all data for foreign key of update object by create new reference toplink object, add reference_id to this object and set it to update object. I waste a lot of time, its very handwork and tire. Are you has any solution about this problem?
    Thank in advanced.
    ThangNQ

  • Constraint Problem in Foreign key --- Very Urgent - Help Needed

    Hello All,
    There are 2 tables and their associated fields
    EmpProj
    Emp_id(pk)
    Proj_id (pk)
    eff_from_dt(pk)
    ProjDesc
    Proj_id(fk)
    eff_from_dt(fk)
    Proj_name
    I have created the 2 tables like shown below
    CREATE TABLE EMPPROJ
    (EMP_ID NUMBER,
    PROJ_ID NUMBER,
    eff_from_dte date,
    PRIMARY KEY(EMP_ID,PROJ_ID,EFF_FROM_DT)
    CREATE TABLE PROJDESC
    (PROJ_ID NUMBER,
    PROJ_NAME VRACHAR2(20),
    EFF_FROM_DT DATE,
    CONSTRAINT S2 FOREIGN KEY(PROJ_ID,EFF_FROM_DT) REFERENCES EMPPROJ(PROJ_ID,EFF_FROM_DT));
    Now whenever i try to create a foriegn key table it gives an error message like "No matching parent key found."
    The columns in the foreign key should be same in number, same datatype and size. you can't create a foreign key with one column for a primary key of two columns.
    What i need to do to refer only the two columns in the Primary Key by a Foreign key?
    Please suggest anyway to resolve this problem.
    Thanks in advance.
    Captain

    My question is
    The foreign key can not refer only partial column of primary key as the rule of RDMS.
    How should i achieve that by other alternatives?
    Please suggest any method.
    Thanks in advance.

  • SQL Developer Data Modeler - Relation to Foreign Key Generation

    SQL Developer Data Modeler 2.0.0 Build 584.
    I am having trouble with Relations to Foreign Keys when Forward Engineering a Relational Model from a Logical Model.
    First of all, the Naming Standard is not applied to the Foreign Keys when I perform the Engineer to Relational Model.
    So I right click on the Relational Model from the Browser and Apply Naming Standards to Keys and Constraints.
    I uncheck everything but Foreign Keys.
    Now, Foreign Keys are named according to my Naming Standards.
    However, this process also performs renames on the Column Foreign Keys even though I specifically unchecked that option.
    This appears to be a BUG in the software and I haven't found a way around it.
    I tried using {column} instead of {ref column} in the Naming Standard Template for Column Foreign Key, but that simply resulted in renaming my columns to "{column}".
    Please confirm and/or let me know of any work-around for this.
    Thanks,
    Dan

    Hi Philip,
    Thanks for the reply.
    Is this recorded as a bug to be addressed in the future?
    Should I submit this problem via Oracle Support?
    The other work-around I came up with is to override every Relation name in the Logical Model with the name I want to use in the Relational Model.
    When the Relational Model is Engineered, this becomes my Foreign Key name.
    Of course, this is not how I want to do things, so I am hoping for a bug fix someday.
    Regards,
    Dan

  • ADF-Master detail-Foreign key generated By Trigger won't propaget to Detail

    Hi All,
    We have Master-Detail Table where Master table key is generated by DB.
    And this key act as Foreign key in detail table.When we Creates Master Table records and commit it .It gets saved correctly But when we navigate to Create Detail record (Cretae button is taken from Detail) It opens in Create mode but does n't poppulate Foreign Key.
    Can anybody plz explain..
    Regards
    Yogesh

    Hi Frank,
    Thanks for your reply.I don't know "the ADF Business Components tester "
    what is this ?
    I was able to solve my problem by making "Refresh after insert " Check box selected in Entity object.Now it is generating Master Key and also i am getting it in Detail.
    But now problem is, Can we make details record in insert mode by 'Create opration' under Master View.My requirment is insert two records in detail table in background while inserting record in master.Where relationship is maintained by foreign key which generated by trigger.
    I want master and detail create form on same page where i will make details from Rendering False i.e both should be in Create mode (Accesser should not retrive record).
    In Short
    ADF-BC Master Detail - Detail Record insert in Back ground on the same page
    Thanks in Adv
    RHY

Maybe you are looking for

  • How to put material and service in the same order

    I want to put the material and service in the same order. How do it input different taxes. and also migo for one material item and other service item.

  • HT4061 My orange film to go has gone,when I go to iTunes I get the terms and conditions page but no film , help

    I downloaded an orange film to go, now I can't find it, when I try to download it again I get a message saying code already used. And in iTunes I only get the terms and conditions page

  • Help me Please I have a connection problem

    So I saw a unknown device trying to connect to my router so I decided to track it as an intruder, and after an hour I saw that it was still there so I decided to remove(while I was still tracking it). I didn't know that device was my Pod touch and no

  • Database creation fail

    hi, iam using oracle 10g, OS : Windows-7, defautly 10g specifies 8k block_size, bt i need to create a 16k block_size database...and with TOTAL PHYSICAL MEMORY : 2038MB i set......... SGA : 734 MB PGA : 244 MB Oracle process size : 40 MB Total memory

  • ABAP code is not shown in SQ01

    Hi, can somebody help us to understand why ABAP code inserted in a query is shown in SE38 but not in SQ01? The query was probably created with Quickviewer. How can we correct this? Thank you.