Create Foreign Key forced in Warehouse Builder

Hello world

Yet once I need your help, please.
My question is: Warehouse Builder is a way to create relationships between the Dimension Tables and one fact Table?
I give you a simple example:
We have produced paintings, customer, sales. So product and customer become a dimension table and sales become a fact table. In this fact table, we store the product_table_key, the customer_table_key and the messure of sale itself.
If we think of datamodeling aspects our relationship 1: n between product_dimension_table and fact_table and also a relationship 1: n between customer_dimension_table and fact_table.
How can we create these reports in the Warehouse Builder?
If we design the objects of SQL database, we could create the need forced like that:
Fact_table ALTER TABLE ADD (REFERENCES of KEY FOREIGN (customer_dim_fk) customer (customer_table_key));

Please let me know how we can treat them in Warehouse Builder. I don't want to create which restricts manually in SQL Developer later.
Thank you very much!

Kind regards
David

Hi David,

You can create the foreign key in OWB.
An example of comprime1 that is created or imported in OWB.
Open the T1 table in the data editor.
Click constraints
Type a name for the constraint
Set the foreign key type
Choose the local column on which you want to create the FK
Now goto reference tab and choose the table and column (PK) whereby the CF should have a reference.

She's.
Save and generate the table T1 script you will have something similar to the following

ALTER TABLE '' ADD CONSTRAINT '' FOREIGN KEY ('')
REFERENCES "" ("");

You can do a lot of settings on this FK in Table T1---> configure---> foreign keys

Thank you
Fati

Tags: Business Intelligence

Similar Questions

  • Online syntax to create Foreign key with Alter Table statement

    I am a pretty meticulous reader. That being said, from the 4 texts that I read to start to learn SQL, I do not remember and do more that probably not, find a syntax online for the creation of a CF with the statement alter table.

    Just something I thought while I was reading.

    Is there a such syntax?

    And if so someone can give me direction on my code?

    ALTER table emp4 change employee_id key foreign employees of references (employe_id);

    It gives me the option error invalid alter table.

    Any idea would be appreciated.

    Thank you.

    rp0428 wrote:

    A foreign key is a constraint, you must use ADD CONSTRAINT.

    Thare is more than one way to skin a cat:

    SQL > create table tbl (id number, name varchar2 (10))
    2.

    Table created.

    SQL > alter table tbl adds (foreign key references emp (empno))
    2.

    Modified table.

    SQL > select constraint_name,.
    2 constraint_type
    3 from user_constraints
    4 where table_name = 'TBL '.
    5.

    CONSTRAINT_NAME C
    ------------------------------ -
    SYS_C0021920 R

    SQL > drop table tbl purge
    2.

    Deleted table.

    SQL > create table tbl (id number, name varchar2 (10))
    2.

    Table created.

    SQL > alter table tbl change (foreign key references emp (empno))
    2.

    Modified table.

    SQL > select constraint_name,.
    2 constraint_type
    3 from user_constraints
    4 where table_name = 'TBL '.
    5.

    CONSTRAINT_NAME C
    ------------------------------ -
    SYS_C0021921 R

    SQL >

    SY.

  • missing closing parenthesis when creating foreign key

    Schema1.Table1 ALTER TABLE ADD (CONSTRAINT test_FK

    FOREIGN KEY (test)

    REFERENCES schema1.table2 (test)

    USING INDEX TABLESPACE indextb);

    With the HELP of INDEX TABLESPACE indextb)

    *

    ERROR on line 4:

    ORA-00907: lack of right parenthesis

    Please help, I tried several times. But I still get the same error

    Delete the TABLESPACE of INDEX clause to HELP.  It is not valid here.

    Create a foreign key does not implicitly create an index.  Since there is no index, there is no tablespace to worry.  As a general rule, you don't want to create an index to support the how foreign key constraint there a sense perhaps specify a tablespace.

    Justin

  • Unique key and foreign key in the view of materialzied

    Hello world
    I have one main site and 4 materialized view sites.
    In my main site, I did a main group that contains my tables participating in replication.
    I have a table that has a primary key, foreign key constraint unique.
    In my first materialized view site I did group for my opinion

    BEGIN
    DBMS_REPCAT. () CREATE_MVIEW_REPGROUP
    gname = > "hr_repg"
    Master = > "orc1.com"
    propagation_mode = > 'ASYNCHRONOUS');
    END;
    /

    BEGIN
    DBMS_REFRESH. DO)
    name = > 'mviewadmin.hr_refg ',.
    list = > ",
    next_date = > SYSDATE,.
    interval = > 'SYSDATE + 1/144',.
    implicit_destroy = > FALSE,
    rollback_seg = > ",
    push_deferred_rpc = > TRUE,
    refresh_after_errors = > FALSE);
    END;
    /

    Then I created the materialized view

    HR.test CREATE MATERIALIZED VIEW
    COOL OFF QUICKLY WITH A PRIMARY FOR THE UPDATE KEY
    AS SELECT * FROM [email protected]
    /

    BEGIN
    DBMS_REPCAT. () CREATE_MVIEW_REPOBJECT
    gname = > "hr_repg"
    sName = > 'hr ',.
    oname = > 'test ',.
    Type = > "SNAPSHOT."
    min_communication = > TRUE);
    END;
    /

    BEGIN
    DBMS_REFRESH. ADD)
    name = > 'mviewadmin.hr_refg ',.
    list = > "hr_test.test"
    Lax = > TRUE);
    END;
    /

    When I check the test (materialized view) table in the site of the materialized view to a primary key, but it has no foreign key forced unique having the base table and because my test materialized view can be changed I need to have these 2 constraint on my my materialized view. You have an idea why these 2 constraint were not created on my materialized view? And what should I do to have these two constraints.

    Thanks in advance

    On MView is created automatically only PK. Other constraints (check, not null, unique or FK) should be created manulay. Indexes also.
    But be careful with the FK.
    On ORACLE8, I found lines that are inserted to updatable mview back in deleted updating process, then inserted (downloaded on the main site). When FK is with on delete cascade that the lines of the child tables (mviews are removed too). And when the child mview is updated before mview parent you found the child missing lines.
    When CF is on delete restrict that you refresh the process fails.

  • actually logical foreign keys

    Hello

    Can I define foreign keys in the logical fact table? I need to use '= count distinct aggregation rule' column of the foreign key in my reports.

    Thank you.

    Andy

    Hi Andy,.

    You can add foreign keys to your fact table as a measure column (aggregate distinct count).

    Do not use these foreign keys to create foreign key joins in the logic layer. Always use complex joins (http://obibb.wordpress.com/2010/08/06/joins-in-oracle-bi-ee/)

    Good luck

    Daan Bakboord
    http://obibb.WordPress.com

  • Foreign key between 2 application system.

    Hello
    I work with the Oracle 10 g designer and so far there is no need for what I would like to explain.

    Well, we have a shared Workarea Global, 2 Application (AS1, AS2) systems and 2 (C1, C2) - containers for each container Application System (-> C1-> C2 AS2 AS1).

    I created a single entity (E1) in C1 and another entity (E2) in C2.
    Now I want to make the relationship between E1 and E2, E1 for example refer to the E2.

    Could someone explain what are the right steps to get there?
    To achieve that, when I run the transformer design of database it creates Foreign Key in the server for E1 model.

    I have tried different "methods", but obviously I do a few mistakes in the steps...

    Thank you!
    Zlatko

    Instructions step by step are in the online help. So, what exactly is not clear? What is:

    I tried and nothing

    I do like this in the RON:
    -Right-click on the node of the System Application child node.
    -Choose Create reference
    -Select the parent Application System
    -Select the table (or any object type) you want to reference

  • Foreign keys without ON DELETE CASCADE; Database design question

    It's the 3rd company, while I work, where I see that created foreign keys
    ON DELETE CASCADE
    clause.
    My colleague said that it is created without the ON DELETE CASCADE clause in order to complicate the deletion of data (records of children). Thus, for codes of the Purge and archive, before we delete the parent table we must remove from the child table first.

    Occasinaly, something is wrong and we will end up disabling FKs make them all and then purging, archiving, etc...

    So, is it not better to create foreign keys with the clause ON DELETE CASCADE, rather than having all these hassles?

    Experience, no matter what you think?

    Personally, I am firmly in the removal of the brand of hard data camp. In the vast majority of cases, trying to remove an active parent is an error if the user must be informed of what they are trying to do and must make a conscious effort to do so (in other words, remove first the children).

    John

  • Should I create primary keys or foreign first?

    I'm new to sql and a student please bear with me.

    I create a script so that when I run a sequence of tables are created. I created all of my fine tables but now I want to add the primary and foreign keys. I tried to do all this at once before but had problems, my idea was to use alter table instructions and add the constraints of key primary and foreign in this way.

    The thing I want to know is what to build first? Should I do any foreign keys and primary keys or visa versa? Or can I do them sequentially and connect relationships between the tables that I will. Thanks in advance!

    Hello

    One thing to remember as a student is to apply logic to the task at hand. In this case, to create a foreign key, it must refer to a primary key in its definition as well so the KP must exist first. What I tend to do is to break down as statements in separate files or sections separate scripts and execute it in a logical order. IE Tables first, and then of PK and UK followed by the FK etc.. I also prefer to create offline rather than constraints in create table statements.

    Hope this helps

    André

  • Create a key to a view foreign Mat?

    You can create a key foreign to a view mast?

    I try, but it doesn't seem to work. I use Oracle 10.2.0.4.0

    create table myproj in select * from caa_project;

    ALTER table MyProj to add the constraint x key PRIMARY (ppm_proj_nam);

    Create materialized view refresh build testvw IMMEDIATE enable complete rewrite of query like select distinct cawp_v2 ppm_proj_nam
    ;

    create an index only testvwi on testvw (ppm_proj_nam);

    MyProj ALTER TABLE ADD CONSTRAINT CAA_PROJECT_FK1
    (FOREIGN KEY)
    PPM_PROJ_NAM
    )
    REFERENCES testvw
    (
    PPM_proj_nam
    ) ;


    I get "no matching unique or primary key for this list of columns" Ora-02270

    I'm doing something wrong or is this all just not supported?

    Thank you.

    try to use

    ALTER table testvw add constraint testvw_u unique (ppm_proj_nam) or
    ALTER table testvw add the key primary constraint testvw_pk (ppm_proj_nam)

    Instead of

    create an index only testvwi on testvw (ppm_proj_nam);

    I created this constraint for oracle 10.2.0.4 DB

    Concerning
    Andrey

  • Creating a relationship creates no foreign key attribute (s)

    Hello

    In my logical model, I have an entity supertype/subtype with 2 subtypes with no own attributes (each subtype has only 1: m relationship). When I create the relationship of 1:m of subtype to another entity (the entity-side m), there is no attribute generated FK. I found a trick to create the relationship first of Supertype in the other entity, and then reconnect it to the subtype. Then, the foreign key is generated (I see that in the dialogue relationship property > FK attributes).

    So I guess it's a bug.

    Robert

    Hi Robert,.

    Thanks for reporting the issue that is fixed in 4.1.2 code

    Philippe

  • Foreign key, check force

    Hello

    This is the structure of two two table.

    Untitled.png

    DDL:

    CREATE TABLE TEST_PARENT
      (
        PARENT_KEY NUMBER (22),
        PARENT_ID NUMBER (22),
        PARENT_NAME VARCHAR2 (255 CHAR),
        EFFECTIVE_START_DATE DATE DEFAULT sysdate NOT NULL ,
        EFFECTIVE_END_DATE   DATE
      ) ;
    ALTER TABLE TEST_PARENT ADD CONSTRAINT PK_TEST_PARENT PRIMARY KEY ( PARENT_KEY ) ;
    
    
    CREATE TABLE TEST_CHANNEL
      (
    
    
        CHANNEL_KEY NUMBER (22),
        CHANNEL_ID NUMBER (22),
        CHANNEL_NAME VARCHAR2 (255 CHAR),
        EFFECTIVE_START_DATE DATE DEFAULT sysdate NOT NULL ,
        EFFECTIVE_END_DATE   DATE 
      ) ;
    ALTER TABLE TEST_CHANNEL ADD CONSTRAINT PK_TEST_CHANNEL PRIMARY KEY ( CHANNEL_KEY ) ;
    

    Logic:

    Parent_id is always fixed to a Parent. But a Parent can have different attributes (parent_name here). Where the attributes are changing it will end the bu previous records put a value to effective_end_date and it will create a new line. New line will have the PARENT_KEY new PARENT_NAME with new effective_start_date and null in effective_end_date.

    Same logic applies to the CHILD table as well.

    What is the best way to put a reference to the type of the foreign key in the CHILD table that in case, will ensure that a child cannot exist without a parent now. I can't take PARENT_KEY as a foreign key to the same parent can change the PARENT_KEY and a child must always point to the parent ASSET (EFFECTIVE_END_DATE as null) folder.

    Thanks in advance.

    I would enrich your datamodel by tables of the object/version as:

    CREATE TABLE TEST_PARENT_OT
    (
    NUMBER OF PARENT_KEY (22) NOT NULL
    ) ;

    ALTER TABLE TEST_PARENT_OT ADD CONSTRAINT PK_TEST_PARENT_OT PRIMARY KEY (PARENT_KEY);

    CREATE TABLE TEST_PARENT_VT
    (
    NUMBER OF PARENT_KEY (22) NOT NULL,
    NUMBER of VERSION_ID (22) not null,
    PARENT_NAME VARCHAR2 (255 CHAR),
    EFFECTIVE_START_DATE DATE default sysdate NOT NULL,
    DATE OF EFFECTIVE_END_DATE
    ) ;

    ALTER TABLE TEST_PARENT_VT ADD CONSTRAINT PK_TEST_PARENT_VT PRIMARY KEY (PARENT_KEY, VERSION_ID);
    ALTER TABLE TEST_PARENT_VT add CONSTRAINT FK_PARENT_VT_PARENT_OT foreign key (parent_key) refers to test_parent_ot (parent_key);

    CREATE TABLE TEST_CHANNEL_OT
    (
    NUMBER OF CHANNEL_KEY (22) NOT NULL
    ) ;

    ALTER TABLE TEST_CHANNEL_OT ADD CONSTRAINT PK_TEST_CHANNEL_OT PRIMARY KEY (CHANNEL_KEY);

    CREATE TABLE TEST_CHANNEL_VT
    (
    NUMBER OF CHANNEL_KEY (22) NOT NULL,
    NUMBER OF VERSION_ID (22) NOT NULL,
    PARENT_KEY NUMBER (22) NOT NULL,
    CHANNEL_NAME VARCHAR2 (255 CHAR),
    EFFECTIVE_START_DATE DATE default sysdate NOT NULL,
    DATE OF EFFECTIVE_END_DATE
    ) ;

    ALTER TABLE TEST_CHANNEL_VT ADD CONSTRAINT PK_TEST_CHANNEL_VT PRIMARY KEY (CHANNEL_KEY, VERSION_ID);
    ALTER TABLE TEST_CHANNEL_VT add CONSTRAINT FK_CHANNEL_VT_CHANNEL_OT FOREIGN KEY (channel_key) REFERENCES TEST_CHANNEL_OT (channel_key);
    ALTER TABLE TEST_CHANNEL_VT add CONSTRAINT FK_CHANNEL_VT_PARENT_OT FOREIGN KEY (PARENT_key) REFERENCES test_parent_ot (parrent_key);

    Using this you will not have to reallocate your child of the lines when a new version of parent is created and you will be able to have the independent channel versions of the parent versions (so no need to change all the children when the parents ends).

    the construction of views of parents and the channels which only show active lines.

    The problem you may have is to be sure to have for each point in time an active version and so I would not implement of an effective_end date, but inherit the effective end of the effective next to (which is a little more work but you will help gapelessness if necessary)

    HTH

  • Can we create a foreign key by using built in functions?

    Hi all

    I'm in the need to create a foreign key referring to an expression of a column in another table.

    For example, I try below and I got some errors.

    CREATE TABLE TABLE_A

    (

    student_id VARCHAR2 (30),

    student_name VARCHAR2 (100),

    CONSTRAINT fk_A FOREIGN KEY (student_id) REFERENCES TABLE_B (UPPER (column_name))

    );

    Please suggest if it is possible that a foreign key could be made in an expression or not?

    2761969 wrote:

    Hi all

    I'm in the need to create a foreign key referring to an expression of a column in another table.

    For example, I try below and I got some errors.

    CREATE TABLE TABLE_A

    (

    student_id VARCHAR2 (30),

    student_name VARCHAR2 (100),

    CONSTRAINT fk_A FOREIGN KEY (student_id) REFERENCES TABLE_B (UPPER (column_name))

    );

    Please suggest if it is possible that a foreign key could be made in an expression or not?

    No - it isn't.

    You can, however, create a VIRTUAL column in the parent table, and then create a foreign key that references.

  • creating tables with references to foreign keys that are not created tables

    I have several patterns to create and each diagram has several tables that reference the columns in each other as a foreign key. So I have to sort out them in the order. In other words, if table A has the foreign key of the Table B column can create B first and then A. are there - it was none I can create a first and then B, that would save a lot of time.

    Hello

    ORA - aff wrote:

    I have several patterns to create and each diagram has several tables that reference the columns in each other as a foreign key. So I have to sort out them in the order. In other words, if table A has the foreign key of the Table B column can create B first and then A. are there - it was none I can create a first and then B, that would save a lot of time.

    You can create A without the constraints of foreign key and then, once the B array has been created, use ALTER TABLE to add the constraints of foreigners has.

  • Create a foreign key constraint against a different schema

    Hi all

    I use the oracle 10g r2 on windows 2003 server database.

    I have a table in the HRMS as STAFF.
    I have another INVENTORY schema, where I want to access a column as a foreign key in HRMS. STAFF (STAFF_ID).
    connect hrms/hrms@orcl
    grant select on STAFF to INVENTORY;
    connect inventory/inventory@orcl
    alter table inv_details add constraint fk_inv_hr_staff foreign key (staff_id) references HRMS.STAFF(STAFF_ID);
    Error report:
    SQL Error: ORA-00942: table or view does not exist
    00942. 00000 -  "table or view does not exist"
    What exactly I have to grant so this diagram of the INVENTORY will be able to create a referential constraint?

    Kind regards.

    You must also grant the privilege of REFERENCES.

    See privileges in table 18-2 at http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_9013.htm#BGBCIIEG

    Hemant K Collette

  • Please, help me to create the foreign key.

    Oracle 10g using sqldbx

    I tried everything I could but all in vain.

    (Folder) CREATE TABLE
    FolderId INT NOT NULL PRIMARY KEY,
    FolderName varchar (255) NOT NULL,
    CreatedBy varchar (255) NOT NULL,
    CreateDate TIMESTAMP NOT NULL
    )


    (Document) CREATE TABLE
    DocumentID INT NOT NULL PRIMARY KEY,
    FolderId INT NOT NULL,
    DocumentTitle varchar (255) NOT NULL,
    DocumentAuthor varchar (255) NOT NULL,
    CreateDate TIMESTAMP NOT NULL
    )



    Document of ALTER TABLE ADD CONSTRAINT fkdocument FOREIGN KEY (document.folderid) REFERENCES (the folder. FOLDERID)

    the last statement says invalid folder name. Help, please

    Hello

    Welcome to the forum!

    See the Manual of the SQL language for the correct syntax:

    ALTER TABLE     document
    ADD CONSTRAINT      fkdocument
    FOREIGN KEY      (folderid)
    REFERENCES      folder (FOLDERID)
    ;
    

    Thanks for posting your code! It is very useful.
    Have you seen the FAQ forum yet? {message: id = 9360002}

Maybe you are looking for

  • HP OfficeJet Pro 8725: Printing envelopes on HP OfficeJet Pro 8725

    How to print envelopes to go with my cards on this new printer.  On my other printers HP is was no problem, but on this one, I get an error "incompatibility".  This is the standard format (half sheet) by cards.  Help, please!  Thank you.

  • My Satellite goes into battery mode despite being connected to the power adapter

    Y at - there anyone out there who can help me, please! I bought a Satellite a couple of years ago which worked well for a while - however, it has started to overheat a lot and kept stop without reason. After many searches on the net, I discovered tha

  • WPF graphics getChildrenAtPoint

    I have a wpf that I add Point Annotations and Annotation driven program, when the user clicks the buttons 'Take Point Annotation' and 'take the Annoation range '. I would choose an annotation when the user clicks top brand him able to change or remov

  • No action by clicking on the desktop icon.

    Vista update downloaded 24 hours ago. Then select "shutdown" to close, message appeared 'install updates and shut down'. I've selected this option and went to bed. At the next startup laptop morning seems to start ok, but when I clicked on one of the

  • BlackBerry smartphones dial # at the end of a phone number

    BB starting and have new tour - how to compose the # at the end of the phone number or inside a call? I tried alt Q and find an option show-keyboard - and have had no success. Thank you!