Primary Key from foreign keys

I have a table which has 3 foreign keys, two of which form the primary key.
I have: ID_Product, ID_Sale, ID_Buy, and also an attribute which tells if its a buy or a sale.
So, if a sale is made, the primary key should consist of ID_Product && ID_Sale, otherwise, it's ID_Product && ID_Buy.
Is there a way to do this in Oracle, and if there is, can you point me to where I can read about this?
thank you in advance

tashe,
This is the wrong forum for you question. Try posting here:
PL/SQL
I will say, however, that there are advantages to keeping your primary keys apart from your data - just populating them from a sequence. Also, you may be temped to enforce this via triggers, but read the following first:
http://tkyte.blogspot.com/2008/05/another-of-day.html
Not that you would have a mutating table problem, but the two table solution may help you. Really think the design through.
Regards,
Dan

Similar Messages

  • Is it possible to create foreign key from composite key in other table.

    SQL> desc PRODUCT_CONFIG_OPTION;
    Name Null? Type
    CONFIG_ITEM_ID NOT NULL VARCHAR2(20) --composite primary key
    CONFIG_OPTION_ID NOT NULL VARCHAR2(20) --composite primary key
    CONFIG_OPTION_NAME VARCHAR2(100)
    DESCRIPTION VARCHAR2(255)
    SEQUENCE_NUM NUMBER(18)
    LAST_UPDATED_STAMP TIMESTAMP(6)
    LAST_UPDATED_TX_STAMP TIMESTAMP(6)
    CREATED_STAMP TIMESTAMP(6)
    CREATED_TX_STAMP TIMESTAMP(6)
    SQL> DESC PRODUCT_CONFIG_ITEM;
    Name Null? Type
    CONFIG_ITEM_ID NOT NULL VARCHAR2(20)
    CONFIG_ITEM_TYPE_ID VARCHAR2(20)
    CONFIG_ITEM_NAME VARCHAR2(100)
    DESCRIPTION VARCHAR2(255)
    LONG_DESCRIPTION CLOB
    IMAGE_URL VARCHAR2(255)
    LAST_UPDATED_STAMP TIMESTAMP(6)
    LAST_UPDATED_TX_STAMP TIMESTAMP(6)
    CREATED_STAMP TIMESTAMP(6)
    CREATED_TX_STAMP TIMESTAMP(6)
    SQL> desc product;
    Name Null? Type
    PRODUCT_ID NOT NULL VARCHAR2(20)
    PRODUCT_TYPE_ID VARCHAR2(20)
    PRIMARY_PRODUCT_CATEGORY_ID VARCHAR2(20)
    MANUFACTURER_PARTY_ID VARCHAR2(20)
    FACILITY_ID VARCHAR2(20)
    INTRODUCTION_DATE TIMESTAMP(6)
    SUPPORT_DISCONTINUATION_DATE TIMESTAMP(6)
    SALES_DISCONTINUATION_DATE TIMESTAMP(6)
    SALES_DISC_WHEN_NOT_AVAIL CHAR(1)
    INTERNAL_NAME VARCHAR2(255)
    BRAND_NAME VARCHAR2(100)
    COMMENTS VARCHAR2(255)
    =========
    CREATE TABLE PROD_CONFIG_PROD_CONFIG_OPTION (
    PRODUCT_ID VARCHAR2(20),
    CONFIG_ITEM_ID VARCHAR2(20),
    CONFIG_OPTION_ID VARCHAR2(20),
    PAGE_NUM_TO NUMBER(18),
    ALTERNATE_PAGE_NUM_TO1 NUMBER(18),
    ALTERNATE_PAGE_NUM_TO2 NUMBER(18),
    ALTERNATE_PAGE_NUM_TO3 NUMBER(18),
    LAST_UPDATED_STAMP TIMESTAMP(6),
    LAST_UPDATED_TX_STAMP TIMESTAMP(6),
    CREATED_STAMP TIMESTAMP(6),
    CREATED_TX_STAMP TIMESTAMP(6),
    CONSTRAINT PK_PROD_CAT_CONFIG_MOD PRIMARY KEY (PRODUCT_ID),
    CONSTRAINT FK_PRODUCT_ID FOREIGN KEY (PRODUCT_ID) REFERENCES PRODUCT(PRODUCT_ID),
    CONSTRAINT FK_CONFIG_ITEM_ID FOREIGN KEY (CONFIG_ITEM_ID) REFERENCES PRODUCT_CONFIG_ITEM(CONFIG_ITEM_ID),
    CONSTRAINT FK_CONFIG_OPTION_ID FOREIGN KEY (CONFIG_OPTION_ID) REFERENCES PRODUCT_CONFIG_OPTION(CONFIG_OPTION_ID) )
    TABLESPACE DATA_SMALL
    i try to create this table if i omit 3rd foreign key constraint then table successfully created.but including trd foreign key constraint it return error "ORA-02270: no matching unique or primary key for this column-list"
    i checked everything is it possible to create foreign key from composite key in other table.

    And
    CONSTRAINT FK_CONFIG_OPTION_ID FOREIGN KEY (CONFIG_ITEM_ID,CONFIG_OPTION_ID) REFERENCES PRODUCT_CONFIG_OPTION(CONFIG_ITEM_ID,CONFIG_OPTION_ID)
    ?

  • How to transfer database table contain null values, primary key, and foreign key to the another database in same server. using INSERT method.

    how to transfer database table contain null values, primary key, and foreign key to the another database in same server. using INSERT method.  thanks

    INSERT targetdb.dbo.tbl (col1, col2, col3, ...)
       SELECT col1, col2, col3, ...
       FROM   sourcedb.dbo.tbl
    Or what is your question really about? Since you talke about foreign keys etc, I suspect that you want to transfer the entire table definition, but you cannot do that with an INSERT statement.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Primary Key and Foreign Key Constraints

    Hi All,
    I would like to know PRIMARY KEY and FOREIGN KEY constraints on existing oracle tables. Could any one suggest me how to find out.
    Thanks,
    RED

    You can query DBA_CONSTRAINTS to get a list of all the constraints on table A and/or table B. The documentation I linked to gives a full list of the data you can see in DBA_CONSTRAINTS, but it includes things like the referenced table name and referenced constraint name for a foreign key constraint. If A is a parent of B or B is a parent of A, you could match up the parent's primary key constraint to the child's foreign key constraint.
    More generally, though, if you don't know that one of the tables is a parent of the other, figuring out how to join the two tables is probably not something that can be done using just the Oracle data dictionary. You would probably need an understanding of the data model being used to figure out what intermediate table(s) needed to be joined in order to relate rows in A to rows in B.
    Justin

  • Primary key and Foreign Key

    Hello,
             I have a question which was asked in an interview
    Can a Primary key in a table also act as a foreign key in the same table ?
    If yes than please provide a simple example
    Thanks
    www.techgulf.blogspot.com

    See this illustration
    create table t
    id int identity(1,1) not null primary key,
    val varchar(100)
    create table t2
    id int not null primary key,
    val varchar(100)
    -- make pk itself as fk to table t
    alter table t2 add constraint fk_t2 foreign key (id) references t(id)
    --some test values to t
    insert t (val)
    values ('test'),('test1'),('test2')
    -- populate t2 first two suceeds
    insert t2(id,val)
    values (1,'iuyi')
    insert t2(id,val)
    values (2,'ef24r')
    -- this will fail as we dont have record with id 4 in t
    insert t2(id,val)
    values (4,'weqw')
    --check the output
    select * from t
    select * from t2
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

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

  • How to create a primary key or foreign key

    in the table student, sid should be the primary key
    in the table prerequisite cnum should be the foreign key and prereq the primary key
    please help me with the syntax thanks.

    As I said in your other post, it's all in the docs, go first to http://tahiti.oracle.com and try to find the answer yourself
    http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/clauses3a.htm#1002630

  • Mapping in OWB with primary key and foreign key relationship

    Hi all,
    I am new to this datawarehousing field. I have just started my career. I have to now create a mapping in owb where a table has a field which is a primary key of another table in the same staging area. If you guys could help me out with the a method it can be created that would be very helpful to me.
    I thought of 2 ideas,
    1. If I can use a look up, but then I am not sure if i can use a lookup for primary key, foreign key relationship. If I can use also, I do not know how to use that.
    2. What if I can directly take that the first table and link the primary key of that table to the second table which uses that primary key of the first table as one of its fields.
    I do not know how feasible these methods are. Please guys help me out.
    Thanks in advance.

    I have a similar case where table a and table b having relation but table a got inserted with data and table b is empty so there no values for foriegn key column in table b to realte with table a.
    Now i want to load table b foriegn key with primary key column values of table a.
    how can we do this in owb
    thanks
    kumar

  • Primary key and Foreign key on same column

    Hi, I am able to create below tables , primary and foreign keys as below.
    But Is this valid design? Can I define a column (ckey2 in table "child") as
    primary key and as well as foreign key?
    CREATE TABLE parent (
    col1 NUMBER,
    col2 NUMBER
    CREATE TABLE child (
    ckey1 NUMBER,
    ckey2 NUMBER,
    ckey3 NUMBER
    alter table parent add constraint parent_pk primary key( col1 );
    alter table child add constraint child_pk primary key( ckey2 );
    alter table child add constraint child_fk foreign key( ckey2 ) references parent( col1);
    Thanks.

    Can I define a column (ckey2 in table "child") as primary key and as well as foreign key?You mean you want to define a one-to-one relationship between parent and child tables.. why would you want to do that ? You might as well merge the 2 tables into one.

  • Primary keys and foreign keys

    Hi,
    is there a script available for changing the value of a primary key which automaticly
    detect all foreigs keys refering to this primary key and change them as well?
    William Oorschot

    I don't have the script now. but you can make a procedure of ur own.
    using a join on user_constraints, and user_cons_columns you can find out all the columns in all the tables which are referencing the particular primary key. once you have the table and the referencing columns, you can change the value of those columns with the new value.
    you'll have to call this procedure from a before row level trigger.
    HTH
    Naveen

  • Reference Field(s) from Foreign Key

    Hello,
    I have a trigger that calls a procedure. I am sending an email based only on INSERTS on TABLE_B. I want to include the FIRST_NAME and LAST_NAME from TABLE_A based on 'SEQ_NO'. TABLE_B has 'FK_SEQ_NO' that references TABLE_A 'SEQ_NO'. Once I get the SEQ_NO from TABLE_A I want to get the FIRST_NAME and LAST_NAME to associate it with TABLE B with my logic. I am not sure on how to do this, any help is appreciated; thanks. If needed I can include my trigger but, would rather the logic in the procedure if possible.
    CREATE OR REPLACE procedure p_email_detail_from_trigger(
       pa_new_fk_seq_no                          varchar2,
       pa_new_item_one                           varchar2,   
       pa_new_item_two                           varchar2
        as
             v_message      varchar2(4000);
           begin
             --build email message
            v_message :=  'The following detail has been added for: ';
            v_message  := v_message || CHR(10)||CHR(13)||CHR(10)||CHR(13)
                                    || '*** FK Seq No: ' 
                                    || pa_new_fk_seq_no
                                    || CHR(10)||CHR(13)
                                    || '*** Item One: '
                                    || pa_new_item_one
                                    || CHR(10)||CHR(13)
                                    || '*** Item Two: '
                                    || pa_new_item_two
                                    || '';
      -- create email
      test_utility.p_update_email_table
      (v_message,'EMAIL_TRIGGER','TEST_EMAIL');
      -- send email
      test_utility.p_sendmail
      ('EMAIL_TRIGGER','TEST_EMAIL');
    end p_email_detail_from_trigger;
    /

    Hi Charles,
    I've added a function one_a to your procedure. I have written it such a way that it should easily be moved into a package. Which you should really do; move your procedure and the new fnction into a package. Don't use stand alone stored procedures, they will become a night mare one day.
    CREATE OR REPLACE procedure p_email_detail_from_trigger(
       pa_new_fk_seq_no                          varchar2,
       pa_new_item_one                           varchar2,   
       pa_new_item_two                           varchar2
    as
             v_message      varchar2(4000);
             a              table_a%rowtype;
             function one_a(p_seq_no  in  varchar2)
             return table_a%rowtype
             is
                one_rec table_a%rowtype;
             begin
                select table_a.*
                  into one_rec
                  from table_a
                 where table_a.seq_no = p_seq_no;
                return one_rec;
             end one_a;
    begin
            -- get record from table_a
            a := one_a(pa_new_fk_seq_no);
            -- Now FIRST_NAME can be found in a.FIRST_NAME
            --build email message
            v_message :=  'The following detail has been added for: ';
            v_message  := v_message || CHR(10)||CHR(13)||CHR(10)||CHR(13)
                                    || '*** FK Seq No: ' 
                                    || pa_new_fk_seq_no
                                    || CHR(10)||CHR(13)
                                    || '*** Item One: '
                                    || pa_new_item_one
                                    || CHR(10)||CHR(13)
                                    || '*** Item Two: '
                                    || pa_new_item_two
                                    || '';
      -- create email
      test_utility.p_update_email_table
      (v_message,'EMAIL_TRIGGER','TEST_EMAIL');
      -- send email
      test_utility.p_sendmail
      ('EMAIL_TRIGGER','TEST_EMAIL');
    end p_email_detail_from_trigger;
    /Note, not tested.
    Regards
    Peter

  • ODI not able to detect primary/foreign keys from XML- user lacks privilege or object not found

    Hi Guys,
    Im trying to load an xml file with two entities address and employee as below. The topology reverse engineering everything works fine. Im even able to view the xml data  in ODI,  but when i try to load the data from these two entities joining by the schema primary keys and foreign keys which odi created on reverse engineering process for xml, im getting the below error.  Im able to load data from one entity, error only occurs when i use the join odi creates internally to identify the xml components employee and address
    XML File:
    <?xml version="1.0" encoding="UTF-8" ?>
    <EMP>
    <Empsch>
    <Employee>
    <EmployeeID>12345</EmployeeID>
    <Initials>t</Initials>
    <LastName>john</LastName>
    <FirstName>doe</FirstName>
    </Employee>
    <Address>
    <WorkPhone>12345</WorkPhone>
    <WorkAddress>Test 234</WorkAddress>
    </Address>
    </Empsch>
    </EMP>
    Topology:  jdbc:snps:xml?f=C:/Temp/RR/Empsch.xml&s=Empsch&re=EMP&dod=true&nobu=false
    Error Message:
    -5501 : 42501 : java.sql.SQLException: user lacks privilege or object not found: EMPSCH.EMPSCHPK
    java.sql.SQLException: user lacks privilege or object not found: EMPSCH.EMPSCHPK
        at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
        at org.hsqldb.jdbc.JDBCPreparedStatement.<init>(Unknown Source)
        at org.hsqldb.jdbc.JDBCConnection.prepareStatement(Unknown Source)
        at com.sunopsis.jdbc.driver.xml.SnpsXmlConnection.prepareStatement(SnpsXmlConnection.java:1232)
        at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at oracle.odi.core.datasource.dwgobject.support.OnConnectOnDisconnectDataSourceAdapter$OnDisconnectCommandExecutionHandler.invoke(OnConnectOnDisconnectDataSourceAdapter.java:200)
        at $Proxy2.prepareStatement(Unknown Source)
        at oracle.odi.runtime.agent.execution.sql.SQLCommand.doInitializeStatement(SQLCommand.java:83)
        at oracle.odi.runtime.agent.execution.sql.SQLCommand.getStatement(SQLCommand.java:117)
        at oracle.odi.runtime.agent.execution.sql.SQLCommand.getStatement(SQLCommand.java:111)
        at oracle.odi.runtime.agent.execution.sql.SQLDataProvider.readData(SQLDataProvider.java:81)
        at oracle.odi.runtime.agent.execution.sql.SQLDataProvider.readData(SQLDataProvider.java:1)
        at oracle.odi.runtime.agent.execution.DataMovementTaskExecutionHandler.handleTask(DataMovementTaskExecutionHandler.java:70)
        at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
        at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
        at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:577)
        at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:468)
        at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2128)
        at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
        at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
        at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
        at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
        at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
        at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
        at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
        at java.lang.Thread.run(Thread.java:662)
    Caused by: org.hsqldb.HsqlException: user lacks privilege or object not found: EMPSCH.EMPSCHPK
        at org.hsqldb.error.Error.error(Unknown Source)
        at org.hsqldb.ExpressionColumn.checkColumnsResolved(Unknown Source)
        at org.hsqldb.QueryExpression.resolve(Unknown Source)
        at org.hsqldb.ParserDQL.compileCursorSpecification(Unknown Source)
        at org.hsqldb.ParserCommand.compilePart(Unknown Source)
        at org.hsqldb.ParserCommand.compileStatement(Unknown Source)
        at org.hsqldb.Session.compileStatement(Unknown Source)
        at org.hsqldb.StatementManager.compile(Unknown Source)
        at org.hsqldb.Session.execute(Unknown Source)
        ... 27 more
    Please advice
    Thanks
    Revanth

    Thats obvious from the xml file contents you have given here. In this xml file You have four complex type. Two of them are employee and address. However the employee doesnot have any relation with address as you have not added the relationship. Thats why its failing. Its not the fault of ODI.
    Also I would suggest not to use auto generated dtd by ODI as you might face problem in future. For example the address type of XML has 8 attributes and 4 of them are not mandatory. That means each of your xml file may have attributes between 4 to 8.  This is where ODI auto generated DTD fails.
    XML Schema complexType Element
    Thanks
    Bhabani

  • Primary&foreign key rerlation ship

    hi folks,
    i am going to pick material in mm03 transaction after that i selected  classification tab choose batches for class type it displays values and clisifications
    now i want to find tables which is having the relation ship (primary key and foreign key)between material number and class type
    so could plz clarify my doubt
    regards,
    sree

    Hi
    Check table DD05S.
    Award points if found useful.
    Regards
    Inder

  • Update primary key that’s also a foreign key in another table

    Hi Developers,
    I need to update the primary key for a record but it's also the foreign key in another table.
    Example,
    Table 1 Details
    Name : Parent_Table
    Columns : ID, Name, Age
    Primary Key : ID
    Table 2 Details
    Name : Child_Table
    Columns : ID, Parent_ID, Name, Age
    Primary Key : ID
    Foreign Key : Parent_ID (Primary Key in Parent_Table)
    Parent_Table
    ID Name Age
    1001 Sam 26
    1002 George 25
    Child_Table
    ID Parent_ID Name Age
    1010 1001 Sam 26
    1020 1002 George 25
    Now I want to update ID (1001) in Parent_table as 2001 and also, I want to update Parent_ID (1001) in Child_Table as 2001.
    How we will write the java code to update these columns.
    Thanks in advance.

    dcminter wrote:
    If you're looking at changing the primary keys in your data then there's probably something wrong with your data structure.Depends how you feel about business primary keys versus surrogates. Personally I prefer the latter so I'm with you in theory. In practice, however, a DB that uses a business PK may well find that it's a legitimate use case to change the key value (but then that's why I like surrogates in the first place!)Primary keys should not have meaning.

  • Binding for table produces list for other tables using foreign key and crea

    Using
    software Jdev 11G, WLS 11G, Oracle DB 11G, Windows Vista platform
    technology EJB 3.0, jspx, backing beans, session bean
    I cannot create a namedquery on my secondary table. The method for the column uses the entity object rather than the name and value of the column.
    For instance,
    (Coketruck) table has inventory records(Products) table
    Coketruck has one to many to the Products table
    Products has a many to one to the Coketruck
    I need to return the products from the product table based on the CokeTruck but I cannot create a namedQuery because the method in the Product table is an entity object type instead of a long that I can use to look up all the products based off the column truck_id.
    This is what I was expecting…
    Private Long truckId;
    public Long getTruckId() {
    return truckId;
    public void setTruckId (Long truckId) {
    this. truckId = truckId;
    Instead this is what I have…
    @ManyToOne
    @JoinColumn(name = "TRUCK_ID")
    private Coketruck coketruck;
    this. coketruck = coketruck
    public Coketruck getCoketruck() {
    return coketruck;
    public void set Coketruck (Coketruck coketruck) {
    this. coketruck = coketruck;
    How do I do a query on the Product table to return all the products that are in the coketruck?
    If I do the following it expects for me to pass the Entity Object which I cannot use as search criteria for my find method.
    @NamedQuery(name = "Products.findById", query = "select o from Products o where o.truckId = :truckId")
    On a different note but the same song…
    I noticed that when I look at my Session Bean Data Contols that the coketruck already has a list of the products. I have created a jsp page with a backing bean and have been able to use the namedquery on the coketruck entity to retrieve the productList. Unfortunately I need to sort the products by type and was also not able to find where to perform the work to be able to iterate through the productList to get my desired display. Therefore I started looking at doing another namedquery that would only retrieve the product_type ordering by the truckId.
    Seems I have come full circle… I don’t care what method I have to use to get the info back.
    Any help is greatly appreciated!

    user9005175 wrote:
    Hi!
    I work on an application wich uses a shopping cart stored in a database. The shopping cart uses two tables:
    CART: Holds information common for one shopping cart: the user it is connected to etc.
    - Primary key: CART_ID
    CART_ROW: One row in the cart, e.g. one new product to buy.
    - Primary key: ROW_ID
    - Foreign key: CART_ROW.CART_ID references CART.CART_ID
    From the code the rows in the cart are collected per cart, as is modelled by the foreign key. There exists one more relationship, which we use in the code, but which is not modelled by a foreign key in the database. One row can be dependent on another row, which makes the other row a parent.
    CART_ROW has a column PARENT_ID which references CART_ROW.ROW_ID.
    Should we add a foreign key for PARENT_ID? Or are there any questions to consider when it is a foreign key to the same table?
    I suggest to add foreign key it wont harm the performance (except while on insert when there would be validation for the foreign key). But it would prevent users to insert wrong/corrupt data either through code or directly by loggin in the database.
    A while ago we added indexes, both on ROW_ID and on PARENT_ID. Could the index on PARENT_ID have been harmful, since there is no foreign key?
    Index on parent_id would only be harmful if you do not make use of index after creating it (i.e. there is no query which make use of this index).
    And if you decide to have a foreign key on parent_id then I suggest to have index too on parent_id as it would be helpful atleast when you delete any record in this table.
    Best regards!

Maybe you are looking for

  • Mainstage 2.1.3 - an error occurred Result code = -39

    mainstage 2.1.3 - an error occurred Result code = -39  . What does this mean. How can I find out what error messages mean. And what can I do to fix it. My session became very unstable- previously saved versions (lighter ) were stable but still got er

  • Xcelsius SDK download help

    This is a silly question...I am at the site https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/bobj_download/main.htm Can anyone tell me which exe I need to download to get the Xcelsius SDK? Thanks

  • Finder shows multiple versions of same shared computer

    Ever since upgrading to Yosemite my finder shows multiple versions of my computer in the "shared" panel of each finder window.  So, instead of just saying "Bedroom Computer," it says "Bedroom Computer," "Bedroom Computer (2)" "Bedroom Computer (3),"

  • Web Server Options for APEX Installation on Oracle Database 10g

    Hi. We are installation a APEX on a test server that is running Oracle Database 10g 10.2.0.4.0. As I understand it there are two Web Server Options: 1) Oracle HTTP Server (Apache) 2) Oracle Application Express Listener Do both of these work for Oracl

  • Can't install new player

    I went to the Adobe Flash Download player site page and no matter how I tried, nothing happened (not even the bar at the top I was told would appear). sometimes the x-in-the-box, sometimes nothing. How can I get/install the new player for sites like