Foreign Keys for a Logical Table

Hi All,
I want to know in which scenarios we create the Foreign Keys for a Logical Table. Once we create the foreign key for the logical table, does it mean that it will automatically override if any joins are there.
Physical Table A, B ( no physical joins)
Logical Table A, B (logical join B(Dim)-->A(Fact))
created the foreign key in logical table A with B .(A.1=B.1)
Will the rpd generate sql with A.1=B.1 join condition for reports.
I tried to create the logical foreign key for logical table A, I could not see any corresponding table option.Here is its snapshot
http://tinypic.com/r/jq1gkz/6
Thanks,
Virat

In general when we go complex joins in Physical layer we go for Logical foreign key joins in BMM layer, best examples is SCD Type-II.
Physical Table A, B ( no physical joins)
-->You need to have a physical join so that this can be override by BMM layer
created the foreign key in logical table A with B .(A.1=B.1) Will the rpd generate sql with A.1=B.1 join condition for reports.
-->Yes you can see this join in BI Physical query.
I tried to create the logical foreign key for logical table A, I could not see any corresponding table option.Here is its snapshot
-->2 cases: 1)You need to delete existing logical joins 2) You might not have join in physical layer.
Hope this helps
Let me know for issues
Edited by: Srini VEERAVALLI on Jan 18, 2013 1:29 PM
BTW: You got very good name, why dont you update in your profile to see your name instead of some number
Edited by: Srini VEERAVALLI on Jan 18, 2013 1:29 PM

Similar Messages

  • Adding a foreign key to an access table

    I have set up two tables in access and I am using SQL insert
    with the form to populate the database. When I “submit”
    the form I receive the following error:
    Element CUST_ID is undefined in CUSTOMER_INFO.
    The error occurred in
    C:\Inetpub\wwwroot\spl_web_site\public_records\order_insert.cfm:
    line 23
    21 : <cfquery datasource="#odbc_datasource#"
    name="desc">
    22 : insert into rec_results (customer_info.cust_id,rec_desc)
    23 : values('#customer_info.cust_id#',
    24 : '#rec_desc#')
    25 : </cfquery>
    How do I get cust_id into the second table to be used as the
    foreigh key when it “has not been created (defined)” in
    the first table?

    If your cust_id is an autonumber primary key field in your
    first table, then you will have to create that record first, then
    retrieve the primary key value to be used as your foreign key in
    your second table, especially if you have foreign key constraints
    on the table. This is normal relational database behavior, since it
    isn't really possible to have a child if there is no parent. In
    this case, you will need some sort or SELECT between your two
    inserts in order to determine the newly created cust_id. Or, you
    may need some other means of gerating your unique PK value for
    cust_id outside of Access. If you do the SELECT method, you would
    do something like SELECT MAX(cust_id) FROM customer_info (assuming
    that cust_id is generated sequentially), and you should enclose all
    three database transactions within CFTRANSACTION tags so that you
    don't accidentally grab the wrong cust_id from another simultaneous
    transaction.
    Phil

  • A question about the multiple source table for the logical table

    Hi All,
    I am to test, having two physical sources for an logical table, but it is failing as it is always getting data from only one table rather than two tables.
    !http://picasaweb.google.com/KSivaUS/OracleForumQuestions#5433761212378087346!
    Any suggestion or inputs would be appreciated.
    Thanks
    Siva

    your 2 measure columns are in the same unique - low level??
    your connections look good.
    which is the result if you bring only the sales column at your report??is it the sum of the 2 datasources??
    try to repass again all your bussiness model.or make an other one.
    fisrt pass your fact with 2 sources and then your dimensions....
    as i can see you have customer_dim,do both of your columns have the appropriate key to this dimension??try to make a physical connection from both fact sources to this dimension as well as for time...
    if you do it in this way ,there is no possibility not to work
    hope i helped...
    http://greekoraclebi.blogspot.com/

  • Foreign Keys and import of tables (ORA-02297)

    How can i get all the foreign keys for a particular schema, basically i'm trying to import tables into a particular schema so i'm trying to disable the constraints, truncate the table , import data and then enable the constraints.
    but i'm having error like these when i disable all the constraints in this particular schema
    Table altered.
    alter table STANDINGS disable constraint P_STANDINGS
    ERROR at line 1:
    ORA-02297: cannot disable constraint (SCDAT.P_STANDINGS) - dependencies exist
    alter table STANDPMTS disable constraint P_STANDPMTS
    ERROR at line 1:
    ORA-02297: cannot disable constraint (SCDAT.P_STANDPMTS) - dependencies exist

    I use a dynamic SQL-Plus script to generate all the constraints for a schema. I then run this SQL to disable the constraints. Sometimes need to run the script more than once depending on the order the constraints are disabled. Once your scripts runs clean, then you can truncate your tables, import your data, and re-enable constraints.
    To re-enable, just use and editor to do REPLACE DISABLE WITH ENABLE....
    Here is sample of my dynamic sql. Needs to be run as SYSDBA...
    set heading off;
    spool c:\disable_constraints.sql;
    select 'ALTER TABLE ' || owner || '.' || table_name || ' DISABLE CONSTRAINT ' || constraint_name || ';'
    from dba_constraints
    where owner = '<owner_name>';
    spool off;
    Hope that helps..

  • ABAP question: define a custom foreign key for a standard field??

    Hi,
    I want to use the field ADDR1_DATA-STR_SUPPL3 for customer use. I must to define a foreign key against a Ztable (as verification table) for this standard field. Also I must to define a custom search help.
    To defining a foreign key for this field, I must be in change mode, so the system ask to me for registering the object. That means this action is a modification. My question is the following: is there any way to do so without SAP standar modification??
    For instance, using BDT events...but how?
    Thanks in advance.
    Regards,
    Rosa

    Hi Rosa,
    Changing SAP Standard dictionary elements is not possible with out changing the same. To change these elements, we dont have any other method apart from SAP standard modification.
    Cheers
    Pavan

  • Enable foreign key for a custom field?

    Hi,
    In my mater table I have a custom field (lumpsum) which has been declared in pa0001 (as a include structure). The same structure has the description for this field.
    My requirement is to assign foreign key for this field to make use of joins in my table view. As this field was into a custom structure of PA0001, I couldnu2019t able to foreign key for this field.
    Please help it
    Regards,
    Vijay

    Hi Vijay,
    Sice it is designed for value check, a foreigh key refers to a TABLE.
    Regards,
    Laurent

  • I have logic pro studio 8 and the upgrade, however it will not upload on my mac book pro. It says i need a product key for the logic 9 and it come with one.

    I have logic pro studio 8 and the upgrade (logic pro 9) and it will not load up to my new mac book pro.  Its asking for a product key for the logic pro 9 upgrade and there wasn't one in the box.  i need some help

    Contact AppleCare... Explain you are a Logic User and you should be transfered to a Product Specialist to assist you with your Issue.

  • How to create a foreign key for the table from two different tables?

    Hi All,
    I have a three table like below. In the below table SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK will be having the primary key for NAME column. The same SAMPLE_CONS3_CHECK table also having the primary key for NAME column and forieign key for SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK tables. See the below code 2
    code 1:
    CREATE TABLE SAMPLE_CONS_CHECK
            (NAME VARCHAR2(10),
            SERIES  VARCHAR2(5)
    CREATE TABLE SAMPLE_CONS2_CHECK
            (NAME  VARCHAR2(5),
             MODEL  NUMBER
    CREATE TABLE SAMPLE_CONS3_CHECK
            (NAME  VARCHAR2(5),
             MODEL_NO  NUMBER
            )code 2
    alter table SAMPLE_CONS_CHECK
    add constraint SAMPLE_CONS_CHECK_pk primary key (NAME)
    alter table SAMPLE_CONS2_CHECK
    add constraint SAMPLE_CONS2_CHECK_pk primary key (NAME)
    alter table SAMPLE_CONS3_CHECK
    add constraint SAMPLE_CONS3_CHECK_pk primary key (NAME)
    ALTER TABLE SAMPLE_CONS3_CHECK ADD
    CONSTRAINT SAMPLE_CONS3_CHECK_FK1 FOREIGN KEY
         NAME
    ) REFERENCES SAMPLE_CONS_CHECK
        NAME
    ) ON DELETE CASCADE;
    ALTER TABLE SAMPLE_CONS3_CHECK ADD
    CONSTRAINT SAMPLE_CONS3_CHECK_FK2 FOREIGN KEY
         NAME
    ) REFERENCES SAMPLE_CONS2_CHECK
        NAME
    ) ON DELETE CASCADE;From the above schenario i am able to insert the data to SAMPLE_CONS3_CHECK table. But the parent data is already available in the parent table. The problem is here two different constarints from two different tables. While inserting, it is checking from both the tables whether the parent is exist or not.
    How can i solve this problem? Can anyone halp me about this?
    Thanks
    Edited by: orasuriya on Aug 8, 2009 2:02 AM

    Actually the design is completely incorrect.
    What you say is
    I have
    'foo', 'foo series'
    'foo','foo model'
    'foo',666
    By virtue of table3 referring to both table1 and table2.
    This means you actually need to have 1 (one) table:
    'foo','foo series','foo model', 666
    And the 'problem' disappears.
    Sybrand Bakker
    Senior Oracle DBA

  • Detect the fields which are primary/foreign keys for each schema's tables

    Hello everybody,
    I'd like to know if it's possible to select a field in one of the dictionary tables to identify the fields of a table which are PK or FK in this one. I'd like to do this to generate the fields that I need to put in a technical design.
    Actually I have this (if it can help you to understand what I'd like to do) :
    select table_name "Table name",
    column_name "Physical field name",
    case when data_type = 'NUMBER' then data_type || '(' || NVL(data_precision,0) || ',' || NVL(data_scale,0) || ')'
    when data_type = 'VARCHAR2' then data_type || '(' || data_length || ')'
    else data_type
    end "Datatype",
    case when nullable = 'Y' then 'FALSE'
    when nullable = 'N' then 'TRUE'
    end "Not null",
    /* Here I'd like to retrieve TRUE or FALSE if the field to display is a primary key or not and the same for foreign keys*/
    from all_tab_columns
    where table_name in (select table_name
    from all_tables
    where table_name like '%project_name%'
    and table_name not like '%TMP%');
    Thanks a lot for your help,
    Florent

    Please investigate all_constraints and all_cons_colums.
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14237/toc.htm

  • Question on indexing foreign key for replicated table

    Hi everybody,
    I have 2 tables with following script
    create table
    parent(parent_id number(2) not null,
    parent_name varchar(20),
    constraint parent_pk primary key(parent_id))
    create table child(child_id number(2) not null,
    parent_id number(2) not null,
    child_name varchar2(20),
    constraint pk_child primary key(child_id,parent_id),
    constraint fk_child foreign key (parent_id) references parenr(parent_id)
    I want to replicate them and I know to replicate these 2 tables i should add them to my replication group, my question is that the child_id has foreign key so as below link says
    http://dbataj.blogspot.com/2007/11/advance-replication-part-ii-master.html
    I should put an index on the foreign key.What type of index should it be and is the following script correct for my purpose?
    CREATE BITMAP
    INDEX "fk_child"
    ON child ("PARENT_ID")
    TABLESPACE "USERS"
    I would appreciate your help in advance.
    Mery

    A bitmap index is almost certainly not the sort of index you'd want to create. You would normally want just a normal index, i.e.
    CREATE INDEX fk_child
      ON child( parent_id )on the master database just to support normal DML operations (otherwise, deleting a row from the parent table requires doing a full table scan on the child table to see if there are any orphaned child records).
    If you are trying to set up a multi-master replication environment, you would also need to replicate this index, since you'll want to support basic DML on both nodes.
    Justin

  • Multiple foreign keys to a single table

    Hi,
    I need to write an SQL sentence to bring a unique row formed from multiple foreign keys which are dependent on the same table. The two tables as follow:
    CREATE TABLE UNIDADMEDIDA (
    IDUNIDADMEDIDA NUMERIC(3) NOT NULL,
    DESCRIPCION VARCHAR2(128) NOT NULL,
    CONSTRAINT PKUM PRIMARY KEY(IDUNIDADMEDIDA)
    CREATE TABLE TRANSPORTE (
    IDBOLETA NUMERIC(12) NOT NULL,
    CORRELAVEHICULO NUMERIC(2) NOT NULL,
    TIPOVEHICULO NUMERIC(1),
    TIPOGASOLINA NUMERIC(1),
    CANTIDAD NUMERIC(8),
    RECORRIDOPROMEDIO NUMERIC(10,2),
    IDUMRECORRIDO NUMERIC(3),
    CONSUMOPROMEDIO NUMERIC(10,2),
    IDUMCONSUMOPROM NUMERIC(3),
    CONSUMOTOTALANUAL NUMERIC(10,2),
    IDUMCONSUMOTOT NUMERIC(3),
    CONSTRAINT PKTRANSPORT PRIMARY KEY(IDBOLETA, CORRELAVEHICULO),
    CONSTRAINT FKUMRECORRI FOREIGN KEY(IDUMRECORRIDO) REFERENCES UNIDADMEDIDA(IDUNIDADMEDIDA),
    CONSTRAINT FKUMCONSUMO FOREIGN KEY(IDUMCONSUMOPROM) REFERENCES UNIDADMEDIDA(IDUNIDADMEDIDA),
    CONSTRAINT FKUMCONSTOT FOREIGN KEY(IDUMCONSUMOTOT) REFERENCES UNIDADMEDIDA(IDUNIDADMEDIDA)
    The columns IDUMRECORRIDO, IDUMCONSUMOPROM and IDUMCONSUMOTOT depend on the table UNIDADMEDIDA (specifically from the IDUNIDADMEDIDA field). I need to bring back the description (DESCRIPCION field) from the different values stored in TRANSPORTE table.
    Thanks for your help!!!
    Mario

    Welcome to the forum!
    Have you thought about joining against the parent table three times to pick up each different description?
    SELECT  <COLUMN LIST>
    ,       UNI_A.DESCRIPCION
    ,       UNI_B.DESCRIPCION
    ,       UNI_C.DESCRIPCION
    FROM    TRANSPORTE
    JOIN    UNIDADMEDIDA    UNI_A   ON UNI_A.IDUNIDADMEDIDA = TRANPORTE.IDUMRECORRIDO
    JOIN    UNIDADMEDIDA    UNI_B   ON UNI_B.IDUNIDADMEDIDA = TRANPORTE.IDUMCONSUMOPROM
    JOIN    UNIDADMEDIDA    UNI_C   ON UNI_C.IDUNIDADMEDIDA = TRANPORTE.IDUMCONSUMOTOT
    ;It is always helpful to provide the following:
    1. Oracle version (SELECT * FROM V$VERSION)
    2. Sample data in the form of CREATE / INSERT statements.
    3. Expected output
    4. Explanation of expected output (A.K.A. "business logic")
    5. Use \ tags for #2 and #3. See FAQ (Link on top right side) for details.
    You provided #2 partially. If you provide the rest we may be able to help you even further.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

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

  • Two foreign keys in one single table

    i have a table 'customers' with a 'customerid' as its primary key and another  table 'drinks' with a primary key 'drinkid'.now i have to create a table 'customerdrink' with its primary key as 'customerdrinkid' , and 'customerid' & 'drinkid' as
    its two foreign keys.how can i write the script in sql server to connect the first two tables with the last one ie how can i relate one primary key(customerdrinkid) with two foreign keys(customerid and drinkid) in a single query?pls help me out!!!

    >> I have a table 'customers' ...<< 
    How nice for you, but where is the DDL? Oh, I see you are the Great and Wonderful “shubha2323” who does not have to follow Netiquette or treat anyone with minimal respect when he demands they do his work him! 
    Where is what you already tried? Oh, the Great and Wonderful “shubha2323” does not try anything! His forum slaves should serve him! 
    Do you understand how rude you are when you ignore the basic forum rules? 
    CREATE TABLE Customers
    (customer_id CHAR(16) NOT NULL PRIMARY KEY,
    CREATE TABLE Drinks
    (drink_id CHAR(10) NOT NULL PRIMARY KEY,
    >> with a customer_id as its primary key and another table Drinks with a primary key drink_id. now I have to create a table 'customer_drink' with its primary key as 'customer_drink_id' <<
    You do not know what single quotes mean in ANSI/ISO Standard SQL, or how to follow ISO-11179 Standards for data element names. And this is a stupid idea. You have a key!! Do you know what a key is? 
    CREATE TABLE Drink_Preferences
    (customer_id CHAR(16) NOT NULL 
      REFERENCES Customers(customer_id)
      ON DELETE CASCADE,
     drink_id CHAR(10) NOT NULL 
      REFERENCES Drinks(drink_id)
      ON DELETE CASCADE,
     PRIMARY KEY (customer_id, drink_id),
     etc
    Stop posting until you have manners and you have read a book on RDBMS. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • SSAS 2008 Linking two cubes on the foreign key between two fact tables

    Hi, all -- 
    I have two cubes:
    Cube 1 has Fact1 (F1, "Events") and 3 dimensions (D1, D2, D3)
    Cube 2 has Fact2 (F2, "Sales") and 3 dimensions (D4, D1, D6)
    As you can see, two cubes reuse D1 as their common dimension.  In addition, F2 foreign keys into F1, e.g. F1 is "Events", and F2 is "Sales".  Every "sale" is an "event", but not every "event" is
    a "sale".
    The question is, how to I link the two cubes and their two respective fact tables on the foreign key?
    Thanks, Austin.

    Hi Austin,
    According to your description, you want to retrieve data from two different cubes, right? In Analysis Services, to query multiple cubes from a single MDX statement you can use the LOOKUPCUBE function (you can't specify multiple cubes in your FROM statement).
    The LOOKUPCUBE function will only work on cubes that utilize the same source database as the cube on which the MDX statement is running. For the detail information about it, please refer to the link below to see the blog.
    Retrieving Data From Multiple Cubes in an MDX Query Using the Lookupcube Function
    If I have anything misunderstood, please point it out.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Multiple foreign key joins between two tables

    Hi,
    I have a question about building a repository.
    I have a date dimension and one fact. The fact table has about 10 foreign key columns that link to the date Dimension.
    In this case should I create 10 aliases to create joins in the Physical and BMM layer or is there any other way to handle this situation.
    I am asking this question because 10 aliases can get very confusing for me at the later point of time while creating reports.
    Using OBIEE 10.1.3

    Hi
    I have a follow up question on this.
    I am okay with not seeing the different date tables under the Subject area. Even if it just shows a it as a Simple DATE Dimension I am good with it.
    In this case which is the efficient way, creating 10 aliases or creating 10 joins in the physical layer. I just figured out that we can create multiple joins between the same set of two tables but do not know how will that effect the way BI server works.
    Please help me in understanding this concept.
    thanks
    This request id for OBIEE 10.1.3

Maybe you are looking for

  • MC.A,MC.B,MB5B,MB58 How to make it usefull for Canadians?

    Hi, We need an AUM option in selection screen & Output of MB5B. Users can know what was available in stock on a prior day when trying to re-concile inventory? Is there any Standard setting to do this kind of things or will it be possible only with Z

  • SSRS Expression

    Hi i am having a column in a table as as xml i converted the values i the placeholder option i am getting as like below. Before converting place holder: False Mini Cookies True Mini Gluten Free Cookies False Mini Brownies  True Mini Desert Pastries L

  • RFC to WS Error

    I am doing RFC to WS  scenario i am getting following error in RFC sender adapter Error in processing caused by: com.sap.aii.af.lib.mp.module.ModuleException: call to messaging system failed: com.sap.engine.interfaces.messaging.api.exception.Messagin

  • My iMac only has one screw on bottom to access memory?

    my iMac has only one screw on bottom to access memory?

  • Upgraded to 1.8.2 now crashes at Info

    I can open the info window to a song just fine. But anymore than just one and it will cause iTunes to crash to a force quit. Can some one help me?