Duplicate record with same primary key in Fact table

Hi all,
   Can the fact table have duplicate record with same primary key . When i checked a cube i could see records with same primary key combination but the key figure values are different. My cube has 6 dimentions (Including Time,Unit and DP) and 2 key figures. So 6 fields combined to form the composite primary key of the fact table. When i checked the records in se16 i could see duplicate records with same primary key. Ther are no parallel loading happening for the cube.
BW system version is 3.1
Data base is : Oracle 10.2
I am not sure how is this possible.
Regards,
PM

Hi Krish,
   I checked the datapacket dimention also. Both the record have same dimention id (141). Except the Keyfigure value there is no other change in the Fact table record.  I know this is against the basic DBMS primary key rule. But i have records like this in the cube.
Can this situation arise when same records is there in different data packet of same request.
Thx,
PM
null

Similar Messages

  • Duplicate entries for same primary key

    Hi,
    I am facing problem to insert 2 or more than 2 entries for same PRIMARY KEY in the database table.
    As I know that we can’t do that. But Client has given me the XL sheet which contains 2 entries for same primary key. How can it be done? Please let me know how can I insert 2 data for same primary key in database table.
    Waiting for your answers.
    Thanks in advance.
    Regards,
    Prasanna

    Hi,
      You can achieve this .... All you have to do is to add a new field (a Sequence Number ) to the table. This number will be incremented for each duplicate primary keys. For example....
    Consider the excel file has duplicate entries 3 primary keys. Now you add a new field named Sequence Number in your DB Table.....
    When you load the data into Database...then the records will look like this...
    Key1     Key2    Key3    Seq
    A          B          C           1
    A          B          C           2
    A          B          D           1
    A          B          D           2
    A          C          D           1
    A          C          E           1
      and so on...
    I hope this solves your purpose.....
    Whenever there are duplicate entries, such as the one mentioned in your scenario, then a new field can be added in Database. This field acts like a count or sequence number.... Thus you can maintain unique records.
    Regards,
    Vara
    Regards,
    Vara

  • 2 tables with same primary key

    Hi,
    2 tables with same primary key is possible,but when is wise to go for such ?
    is that a bad desisn ?
    eg:
    Personal_details_employee
    Official_details_employee
    these 2 tables have same Primary key emp_id.
    plz. reply me at [email protected] also
    thanx
    vikram

    hi Vikram,
    In this case u can have then in one table itself and why do want to have two tables.
    - Suresh.A

  • What is the best practice for creating primary key on fact table?

    what is the best practice for primary key on fact table?
    1. Using composite key
    2. Create a surrogate key
    3. No primary key
    In document, i can only find "From a modeling standpoint, the primary key of the fact table is usually a composite key that is made up of all of its foreign keys."
    http://download.oracle.com/docs/cd/E11882_01/server.112/e16579/logical.htm#i1006423
    I also found a relevant thread states that primary key on fact table is necessary.
    Primary Key on Fact Table.
    But, if no business requires the uniqueness of the records and there is no materilized view, do we still need primary key? is there any other bad affect if there is no primary key on fact table? and any benifits from not creating primary key?

    Well, natural combination of dimensions connected to the fact would be a natural primary key and it would be composite.
    Having an artificial PK might simplify things a bit.
    Having no PK leads to a major mess. Fact should represent a business transaction, or some general event. If you're loading data you want to be able to identify the records that are processed. Also without PK if you forget to make an unique key the access to this fact table will be slow. Plus, having no PK will mean that if you want to used different tools, like Data Modeller in Jbuilder or OWB insert / update functionality it won't function, since there's no PK. Defining a PK for every table is a good practice. Not defining PK is asking for a load of problems, from performance to functionality and data quality.
    Edited by: Cortanamo on 16.12.2010 07:12

  • DBMS_CDC find only the columns that are changed along with the primary key in the table

    Hello,
    We are having a requirement to find the change data in the production environment.
    We are planning to use the DBMS_CDC utility.
    But for  example in the create change table 1 picked emp_id,ename, address, salary,dob.
    I have a sample data of
    empid
    ename
    address
    salary
    DOB
    1
    test1
    24 test street
    2000
    20-Jan-98
    2
    test2
    25 test street
    2500
    15-Aug-97
    if ename for empid 1 is changed to test1_test3 from test1.
    My CDC is capturing  the values in the old and new values in the 5 columns.
    But i need to get only the empid (primary key of the source table) and the ename column as only that's been updated not the rest of the 3 columns.
    Can i accomplish this.
    Please advice.

    Hello,
    Thanks for the information.
    but if i change the change table  then i will miss the other columns right?
    I want to get the columns( empid and ename) only if ename is changed. i.e when ever any column in emp table changes i need to get all the columns where the data is changed along with the primary key columns empid.
    Is there any way i can tweak the parameters so that i can achieve this or is there any other way using the cdc i can get this data.
    Thanks

  • Primary key in Fact table

    Hi ,
    I have a question usually fact table consists of all primary keys from different dimensional tables but i have a requirement like this:
    Fact table consists of non-dimensional columns and one primary key Amount_ID(PK) aand this amount_ID is a FK in another table which records day to day transactions. My question is can a fact table have a PK ?
    Thanks,
    ch

    Yes Fact Table can have a Primary key
    But in your case it looks like the Other Table which is storing Day to Day transaction should be made FACT , and the one you are calling FACT should be made Dimension..
    Well depends again, how you are analysing data and against which attributes
    Thanks
    Ashish

  • Primary key in fact/Dimention/SID table?

    Hello sap gurus,
    2 Questions....
    Which is primary key in
    -Fact table (probably answer is .... combination of DIM_ID keys)
    -Dimention table ( probably answer is .... DIM_ID key)
    -SID table ( probably answer is .... SID_ID key)
    Thnx in advance

    Gaurav,
    You already have the answers. A very simple way to figure out the keys is to use the transaction LISTSCHEMA, it will list the tables in an Infocube. Once you have the tables , you can use se11/se12 to check the keys.
    For ODS information in BI 7, check the link below.
    http://help.sap.com/saphelp_nw70/helpdata/en/80/1a60cae07211d2acb80000e829fbfe/frameset.htm
    For ODS information in BW 3.5 , check the link below
    http://help.sap.com/saphelp_nw04/helpdata/en/c0/99663b3e916a78e10000000a11402f/frameset.htm
    -Saket

  • Null key in fact tables

    Hi all,
    I have one role play dimension with some null key in fact table, I liked know if it's a good practice?
    thanks

    Depends on what you actually mean..
    When one dimension column contains NULL in your fact table, then it's normally a bad practice. Create a entry in your dimension table to represent this state.
    The problem is that NULL is a state, which means does missing or inapplicable information. This means that the row in the fact table is semantically meaningless. Cause your fact table is no longer additive over this dimension.

  • Overwriting a record with part of same primary key

    Hello Everyone,
    Could anyone please give a suggestion about how to overwrite the record with part of same primary key?
    I have  5 key fields.
    A1
    A2
    A3
    A4
    A5
    I have to overwrite the record if A5 changes with same A1 A2 A3 A4.
    I cannot take off A5 as part of primary key. If I use modify or insert, its creating a new record with the new A5. But I am still having the old record in the table (with old A5), which I don't want it to be there.
    Thank you,
    Rushi

    hi,
    That's right.
    u have to delete record from database table .....
    then u can add a new record...
    use delete <database_table> from table <internal_table>

  • Error Record with Same Key

    Can anyone help me out with a master data load failure.
    My request goes off red and the message looks somehow like "Record filtered in advance as error records with the same key exist", "Filter out new records with same key". I have already checked the duplicate handle record setting in DTP. Still why am i getting this error.
    Would appreciate if some one could suggest me in this.

    Hello Shridevi M ,
    When I execute my DTP, I get a master data load failure : "Record filtered in advance as error records with the same key exist" . It's the same as you get. Please tell me how did you solved this probelm?
    Thanks in advance,
    Abdellatif

  • Updating a table with no Primary key

    What I am trying to find out is if you can uniquely update a single record in a table that has no primary key. I see no way to reference the record I want, other than specifying all the field values in a where clause. This is a problem though, because if I have another record with the same field values, that will get updated too. (I know its a bad database design, but some people do it and I need to work around it!!!), there are some situations where you would have identical records as far as a where clause is concerned, for example, you cant use a blob in a where clause so that might be where your records differ...
    In SQLServer 2000, Enterprise manager throws an error if you have a table with no primary key and duplicate records that you try to update through the GUI. EM uses stored procedures to execute updates, and it rolls back ones which result in more than one update result.
    Im not too familiar with Cursors in SQL, only that they are quite slow and not implemented on all DB products. But I think that they might be able to solve the problem (but I dont logically see how).
    Can anybody explain this to me?

    another record with the same field valuesIf you have two records and all the field values are the same then the records are logically the same anyways, so it shouldn't matter if you update both (one would question why there are two records in the first place.) In other words there is no way, either computationally or manually to tell them apart.
    I suspect that that is rather rare. Instead what is more likely is that you are only using some of the fields. So just keep adding fields until it is unique.

  • Problem with the primary key

    Hi All,
    I have a table with the same data repeating 2 times. I mean the rows are depating twice. so now I am creating primary key to the table. It is throwing me an error saying primary key voilation. I will provide the clear scenario.
    create table Employee(
    ID VARCHAR2(4 BYTE) NOT NULL,
    First_Name VARCHAR2(10 BYTE),
    Last_Name VARCHAR2(10 BYTE),
    Start_Date DATE,
    End_Date DATE,
    Salary Number(8,2),
    City VARCHAR2(10 BYTE),
    Description VARCHAR2(15 BYTE)
    insert into employee values ('01','Jason', 'Martin', to_date('19960725','YYYYMMDD'), to_date('20060725','YYYYMMDD'), 1234.56, 'Toronto', 'Programmer');
    insert into employee values ('02','Alison', 'Mathews', to_date('19760321','YYYYMMDD'), to_date('19860221','YYYYMMDD'), 6661.78, 'Vancouver','Tester');
    insert into employee values ('03','James', 'Smith', to_date('19781212','YYYYMMDD'), to_date('19900315','YYYYMMDD'), 6544.78, 'Vancouver','Tester');
    insert into employee values ('04','Celia', 'Rice', to_date('19821024','YYYYMMDD'), to_date('19990421','YYYYMMDD'), 2344.78, 'Vancouver','Manager');
    insert into employee values ('05','Robert', 'Black', to_date('19840115','YYYYMMDD'), to_date('19980808','YYYYMMDD'), 2334.78, 'Vancouver','Tester');
    insert into employee values ('07','David', 'Larry', to_date('19901231','YYYYMMDD'), to_date('19980212','YYYYMMDD'), 7897.78,'New York', 'Manager');
    insert into employee values ('06','Linda', 'Green', to_date('19870730','YYYYMMDD'), to_date('19960104','YYYYMMDD'), 4322.78,'New York', 'Tester');
    insert into employee values ('08','James', 'Cat', to_date('19960917','YYYYMMDD'), to_date('20020415','YYYYMMDD'), 1232.78,'Vancouver', 'Tester')
    insert into employee values ('07','David', 'Larry', to_date('19901231','YYYYMMDD'), to_date('19980212','YYYYMMDD'), 7897.78,'New York', 'Manager');
    insert into employee values ('06','Linda', 'Green', to_date('19870730','YYYYMMDD'), to_date('19960104','YYYYMMDD'), 4322.78,'New York', 'Tester');
    Now the table is with 10 columns
    ID FIRST_NAME LAST_NAME START_DAT END_DATE SALARY CITY DESCRIPTION
    01 Jason Martin 25-JUL-96 25-JUL-06 1234.56 Toronto Programmer
    02 Alison Mathews 21-MAR-76 21-FEB-86 6661.78 Vancouver Tester
    03 James Smith 12-DEC-78 15-MAR-90 6544.78 Vancouver Tester
    04 Celia Rice 24-OCT-82 21-APR-99 2344.78 Vancouver Manager
    05 Robert Black 15-JAN-84 08-AUG-98 2334.78 Vancouver Tester
    06 Linda Green 30-JUL-87 04-JAN-96 4322.78 New York Tester
    07 David Larry 31-DEC-90 12-FEB-98 7897.78 New York Manager
    08 James Cat 17-SEP-96 15-APR-02 1232.78 Vancouver ester
    Creating Primary key to the table
    "ALTER TABLE employee PRIMARY KEY ( ID, First_Name, Last_Name, Start_Date, End_Date,
    Salary, City, Description );"
    I am getting primary key voilation error
    IS THERE ANY WAY TO CREATE PRIMARY KEY ON THE TABLE WITH OUT DELETING THE DATA?
    iS IT POSSIBLE CREATING PRIMARY KEY BY USING 'GROUP BY' FUNCTION OR ANY OTHER FUNCTIONS?
    Edited by: user11872870 on Sep 23, 2010 5:41 PM

    user11872870 wrote:
    Actually there is a small mistake in the question. The table is having the data as
    ID FIRST_NAME LAST_NAME START_DAT END_DATE SALARY CITY DESCRIPTION
    01 Jason Martin 25-JUL-96 25-JUL-06 1234.56 Toronto Programmer
    02 Alison Mathews 21-MAR-76 21-FEB-86 6661.78 Vancouver Tester
    03 James Smith 12-DEC-78 15-MAR-90 6544.78 Vancouver Tester
    04 Celia Rice 24-OCT-82 21-APR-99 2344.78 Vancouver Manager
    05 Robert Black 15-JAN-84 08-AUG-98 2334.78 Vancouver Tester
    06 Linda Green 30-JUL-87 04-JAN-96 4322.78 New York Tester
    07 David Larry 31-DEC-90 12-FEB-98 7897.78 New York Manager
    08 James Cat 17-SEP-96 15-APR-02 1232.78 Vancouver ester
    05 Robert Black 15-JAN-84 08-AUG-98 2334.78 Vancouver "NULL"
    06 Linda Green 30-JUL-87 04-JAN-96 4322.78 New York "NULL"
    There is a null in the duplicate data.....
    As there is NULL in the data It is not allowing me to add the primary key to the table.....
    I am just looking if there is any other way to create primary key with the same data....the reason for the null not allowing you to have unique records is because null means "unknown". I could go into this in more depth but....
    ...again - we need to ask, why do you have linda green and robert black in there twice.
    if you really do need those two extra rows, then create another column with a unique ID using a sequence and make that the primary key. a primary key uniquely identifies a row. for this data I don't see any reason whatsoever to create a composite key like you are attempting.
    by trying to make the entire row a primary key it is clear your understanding is severely lacking.

  • Link to file (blob) with 2 primary keys

    I am experiencing a problem in APEX 3.1.2 with viewing files uploaded through a simple form based on a table. If that table has a single column primary key, the link works perfectly. If the table has a two column primary key, the link throws a "pls/apex/apex_util.get_blob_file not found on server". I made a simple test case and if I change the table to use a 1 column PK, (and change the process on the APEX form to match), the link works. When I change the PK back to 2 columns (and the APEX processes), the link stops working on the same record. Is this a known issue? I couldn't find anything useful in Metalink or these forums.
    I may be missing something obvious, but could someone repeat this test case and let me know if you encounter the same thing?
    1) Create table called test_blob with columns
    id1 number
    id2 number
    file_blob blob
    filename varchar2
    mimetype varchar2
    update_date date
    and a primary key of id1 only
    2) Create an APEX form based on that table and configure the file browse item source with the mimetype fields, filename field, .... (You'll need to unhide the id1 field unless you bothered creating a trigger,etc to populate it)
    3) Upload the document, PDF, ... of your choice
    4) Go back to the form on that record and click the download link. It should work to open the file
    5) Change the primary key on the table to use id1 and id2 and change the processes on the APEX form to use the 2 column primary key
    6) Repeat step 4, but now the link no longer works. If you toggle back to the 1 column PK, the link works again.
    I worked around it by making a new column that concatenates id1 and id2 so I can move my application forward with a 1 column PK, but this is frustrating. BTW, I did try to use the get_blob_file_src API to work around the problem, but the link it generates is identical to that generated automatically so the same problem occurs.
    Rgds/Mark M.

    It rather depends on what access you have and what the keys are, but for my table:
    1) Drop existing primary key constraint
    2) Add a new column called something like key_id
    3) Change your trigger which currently sets your existing id to also set the new key_id by setting key_id := id1 || ' ' || id2;
    4) Add new primary key constraint for new column
    Note that to do these changes, you may need to empty the table.
    Rgds/Mark M.

  • ResultSet updateRow ,insertRow ,deleteRow APIs on table with no PRIMARY KEY

    Hi,
    When I use ResultSet.insertRow , updateRow ,deleteRow API's on a table which contais no primary key column I find the following Exception ,
    java.sql.SQLException: Operation invalid. No primary key for the table
    at com.tandem.sqlmx.Messages.createSQLException(Messages.java:69)
    at com.tandem.sqlmx.SQLMXResultSet.getKeyColumns(SQLMXResultSet.java:3501)
    at com.tandem.sqlmx.SQLMXResultSet.prepareInsertStmt(SQLMXResultSet.java:3652)
    at com.tandem.sqlmx.SQLMXResultSet.insertRow(SQLMXResultSet.java:2073)
    at testdateupdate.main(testdateupdate.java:33)
    It looks like the table needs to have a primary key column to update or insert or delete rows using the ResultSret APIs.
    I use a proprietary JDBC driver. I find the Explanation for this behavior like this ,
    JDBC allows update stmts on tables w/out a primary key defined if the stmt is issued by the application. For updateable ResultSets, a primary key restriction is required to avoid updating more rows than desired.I dont understand this explanation and also I dont find this behavior is some other JDBC drivers that I tried with.
    Some one Please Clarify the same.
    Thanks in Advance.
    Thanks and Regards,
    Jay

    Hi,
    in simple words, when a table does not have primary key you can send update and delete on it only by using a Statement object. When using ResultSet.updateRow or ResultSet.deleteRow the jdbc looks for the primary key on the metadata in order to send the correct where clause to the rdbms. I think that this could maybe work with Oracle DBMS, which has a unique id (ROWID) for each record.
    Kiros

  • Help.......... required :Database table with no primary key

    Hi All,
    I have a table sponsor_logos whose structure is as follows:
    sl__sponsorid number,
    sl__clubid number,
    sl_hallno varchar2(7) not null,
    sl_logofilename varchar2(100) not null,
    sl_date_modified date not null
    Where in the sl__sponsorid and sl__clubid are foreign keys and I do not have any primary key for the table.
    I need to insert into and also delete records from the table.
    I have gone through various topics in the java forum for EJB's to find out what design strategy should I use?
    Some say that if a table does not have primary keys, and if the table is represented by a CMP entity bean all the fields of the table are considered as a part of primary key.In that case what would my code look like and what would my deployment descriptor contain?????
    According to the specification, the CMP or a BMP represents a unique record in a database.In that case should I be using a Session bean to handle insertions and deletions for the table?
    Since this is my first project with EJB's I am really confused as to what design should I be using for this situation. Since I have a time constraint I can't take a long time to decide on what strategy I should use.
    Suggestions regarding this are welcome .

    Hi Maris,
    I have my PK class ready with all the fields in it.
    Deployment descriptor ready with <prim-key-class>package.SponsorLogoPK</prim-key-class>
    . According to descriptor specification there is no need to have an entry for
    <primkey-field>bookingSlNo</primkey-field>
    in case of custom primary key .
    So I have omitted <primkey-field>bookingSlNo</primkey-field>
    I have used the verifier tool and verified the ejb , no errors with regards to this ejb, but , getting errors while deploying:
    An error has occurred.
    Deployment Error -- Error while running ejbc -- Fatal Error from EJB Compiler -- JDO74025: JDOCodeGenerator: Caught an Exception validating CMP bean 'SponsorLogoBean' in application 'resnet_ejb' module 'E:\Sun\AppServer\domains\domain1\applications\j2ee-modules\resnet': JDO72335: If the table SPONSOR_LOGOS for the bean corresponding to the generated class com.resnet.squash.api.entity.SponsorLogoBean483209734_JDOState is mapped as the primary table, it must have a primary key. Choose a different primary table or verify that the contents of the schema file are correct.
    Now what could the problem be . Do I need to do any other setting in the descriptor. I have the cmp-mapping also intact.

Maybe you are looking for