Dbtable without a primary key

hi!
is it possible to create a db-table without a primary key? if there is a possbility, how can i do this?
greetings
stefan

Hello,
The link i provided contains all your answers. Its oracle 8i documentation release. It contains everything that you want to know about oracle 8i release.
What Are Index-Organized Tables?
Index-organized tables are tables with data rows grouped according to the primary key. This clustering is achieved using a B-tree index. B-tree indexes are special types of index trees that differ from regular table B-tree indexes in that they store both the primary key and non-key columns. The attributes of index-organized tables are stored entirely within the physical data structures for the index.
Why Use Index-Organized Tables?
Index-organized tables provide fast key-based access to table data for queries involving exact match and range searches. Changes to the table data (such as adding new rows, updating rows, or deleting rows) result only in updating the index structure (because there is no separate table storage area).
Also, storage requirements are reduced because key columns are not duplicated in the table and index. The remaining non-key columns are stored in the index structure.
Index-organized tables are particularly useful when you are using applications that must retrieve data based on a primary key. Also, index-organized tables are suitable for modeling application-specific index structures. For example, content-based information retrieval applications containing text, image and audio data require inverted indexes that can be effectively modeled using index-organized tables.
See Also: For more details about index-organized tables, see Oracle8i Concepts.
Differences Between Index-Organized and Regular Tables
Index-organized tables are like regular tables with a primary key index on one or more of its columns. However, instead of maintaining two separate storage spaces for the table and Btree index, an index-organized table only maintains a single Btree index containing the primary key of the table and other column values.
Index-organized tables are suitable for accessing data by way of primary key or any key that is a valid prefix of the primary key. Also, there is no duplication of key values because a separate index structure containing the key values and ROWID is not created. Table 14-1 summarizes the difference between an index-organized table and a regular table.
Table 14-1 Comparison of Index-Organized Table with a Regular Table
Regular Table  Index-Organized Table 
ROWID uniquely identifies a row; primary key can be optionally specified 
Primary key uniquely identifies a row; primary key must be specified 
ROWID pseudo-column refers to physical block address 
ROWID pseudocolumn refers to primary key-based logical ROWID 
Secondary indexes store physical data 
Secondary indexes store primary key-based logical ROWID 
Can be stored in a hash or index cluster 
Cannot be stored in a hash or index cluster 
Regards,
Shekhar Kulkarni

Similar Messages

  • Implement Oracle Streams without having Primary Keys

    In our environment, we can't create primary keys so anyone know how to implement oracle streams without having primary keys on the tables.
    Thanks,

    You can JOIN tables on any compatible columns or functions (like LEFT (PONumber,10) ):
    http://technet.microsoft.com/en-us/library/ms191517(v=sql.105).aspx
    BOL: "When the (ON) condition specifies columns, the columns do not have to have the same name or same data type; however, if the data types are not the same, they must be either compatible or types that SQL Server can implicitly convert. If the data types
    cannot be implicitly converted, the condition must explicitly convert the data type by using the CONVERT function. "
    LINK:
    http://technet.microsoft.com/en-us/library/ms177634(v=sql.105).aspx
    Typically tables are JOIN-ed on FK-s and PK-s.
    Kalman Toth Database & OLAP Architect
    SELECT Video Tutorials 4 Hours
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • How to do hibernate mapping for table or view without a primary key

    Hi,
    Anyone knows how to do hibernate mapping for table or view without a primary key?
    thanks.
    cc

    or you can make all column primary key .Anybody seriously considering that as a good idea should understand the implications:
    1. this requires that each row be unique - that's a minor issue normally, but can be a significant problem in some cases
    2. in practically all databases, a primary key constraint creates a unique index - this has many implications:
    a) in most databases, the index stores a copy of the column data that is indexed - this suggestion therefore more than doubles the data storage required for the data
    b) whenever an indexed column is changed, the index has to be maintained - this suggestion then more than doubles the work that each UPDATE statement has to do, since both the table and the index have to be maintained for any UPDATE at all
    This might work OK for toy projects, but it doesn't scale well at all...

  • Updatable report without technical primary key

    Hi,
    I have a number of tables which need a standard updatable query report (MRU/MRD/MRI). However, these tables do not have a generated primary key, but the primary key is edited by the user.
    I've tried generating a standard updatable report for this, however, this doesn't seem to work because it needs a generated primary key.
    So I've tried to write the MRU process myself, which could work. However, how would I add a new row, because this isn't possible unless you use the standard updatable report!!... :S I can't help but think this must be me overlooking something. I can't imagine APEX cannot use standard updatable reports without a generated primary key!
    Who can help?

    The solution you're suggesting is the best in my oppinion as well, however, I would like to know if it's possible to resolve this issue in another way. Using technical key's is best practice, but it's not wrong if you don't... so why isn't there a way in APEX to handle this?
    Maybe using the "Primary Key Source Type" as "Custom PL/SQL Function" in the "Tabular Form Element" is a possibility?
    I will try to convince the customer (other IT department) to use a technical primary key and replace the user generated key by a unique constraint, but ... I just want to know :)
    Edited by: Voxie2 on Jan 7, 2010 2:30 PM

  • How to code the ejbCreate() method without initailizing primary key?

    Hi all,
    I've just started learning about EJBs, and now am at the stage of learning how to create, deploy and test a CMP Entity Bean.
    Ran into a problem which I'm hoping someone can help out with.
    I'm using SQL Server 2000 as my backend database, and have created a simple table called TEST with 2 fields, id and name. id is set as the primary key, and as an identity conlumn. What this means is that when we do inserts, we don't need to specify a value for the id column. SQL Servers automatically generates that value.
    Here's my ejbCreate method in my bean class:
    public Integer ejbCreate(String name) throws CreateException {
        this.setName(name);
    }When I tried to run the create method from a web client, I got this error:
    javax.ejb.CreateException: [EJB:010148]In EJB 'SampleEJB', the primary key field 'id' was not set during ejbCreate. All primary key fields must be initialized during ejbCreate. at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:186) at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:284) at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:244) at everbright.ejb.SampleEJB_uzc4wg_HomeImpl_813_WLStub.create(Unknown Source) at jsp_servlet.__index._jspService(__index.java:152) at weblogic.servlet.jsp.JspBase.service(JspBase.java:33) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6452) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    So it seems like I can't leave the id field uninitialized in the ejbCreate method. However I don't know what to initialize it with either, because in order to know what value I need to initialize it to, I'll need to run a db query to retrieve the next primary key value for the id field. This doesn't sound very efficient to me.
    I tried to initailize it to null, but that gave me a NullPointerException.
    Why do we need to initialize the primary key field in ejbCreate? Should the container do the insert and then get it from the table accordingly?
    Is there any other way I can get this set-up working?
    Thanks!

    Hi Fusion777,
    Ya, I've been searching around forums for an answer also. Apparently this is indeed a problem that has no general solution. It depends on 2 factors:
    1) Whether or not the database supports autogenerate key (which most does) and how (Oracle does it by sequences while SQL Server by identities)
    2) Whether or not the application server supports 1).
    In my case, I'm using SQL Server and Weblogic Server 8.1 and most fortunately, Weblogic does support identities and sequences. Just define the <auto-key-generation> stanza in your weblogic-cmp-rdbms-jar.xml deployment descriptor, as follows:
    <automatic-key-generation>
         <generator-type>ORACLE</generator-type>
         <generator-name>test_sequence</generator-name>
         <key-cache-size>10</key-cache-size>
    </automatic-key-generation>
    <automatic-key-generation>
         <generator-type>SQL-SERVER</generator-type>
    </automatic-key-generation>
    <automatic-key-generation>
         <generator-type>NAMED_SEQUENCE_TABLE</generator-type>
         <generator-name>MY_SEQUENCE_TABLE_NAME</generator-name>
         <key-cache-size>100</key-cache-size>
    </automatic-key-generation>I've tried that and it works :-)
    I gather from your reply that those who are using JBoss are equally fortunate :-)
    So I thought I'll share this in case some other poor fellow is facing the same problem as we are. At least worse come to worse, he'll have the option of switching to either JBoss or Weblogic and know that it works in both :-)
    Some other users seem to be against the idea of using auto-generated keys for precisely the reason that it is not a standard across database and application servers. See this thread:
    http://forum.java.sun.com/thread.jspa?forumID=13&threadID=329896
    I've in fact stopped working on EJB 2.0 and am exploring something called Hibernate, which seems to have a more generic way of dealing with the auto-generated key issue. In fact, I've heard news that EJB 3.0, which is the upcoming standard for EJB, will be heavily inspired by Hibernate as far as CMP Entity Beans are concerned.
    You can check out Hibernate at http://www.hibernate.org.

  • JPQL HOWTO:  "join" entities without foreign/primary keys?

    I have entities Person and Representative.
    Entity Person has fields lastName, firstName and patronymic.
    Entity Representative has field named title.
    The task is:
    Select all Persons and Representatives where representative.title contains Person.firstName, Person.lastName and person.patronymic.
    Person can have several representatives.
    Person and Representative don't have any keys. Is it possible to do it using JPQL or it's better to use native sql query?

    I've tried something like this one:
    public class PersonAndRepresentatives {
         private Person person;
         private List<Representative> representatives;
    //my query:
                    StringBuilder sb = new StringBuilder();
                 sb.append("select new model.stateless.helperobject.PersonAndRepresentatives(p, repr) from Person p, Representative repr");
              sb.append(" where repr.title like p.firstName and repr.title like p.lastName");
              sb.append(" group by person.id");
              List<PersonAndRepresentatives> resultList = em.createQuery(sb.toString()).getResultList();But of course, I get exception on "*,*" which is here: "*from Person p, Representative repr*".
    What can I do?
    Seems like it's better to write native query and do not try to solve the problem using JPQL.

  • How to speed up fast refresh of materialized view without primary key

    Thought I'd share this info, as I couldn't find anything on here to help me diagnose the issue:
    I had a materialized view that was taking longer to perform a fast refresh than it took to perform a complete refresh. My mview had no primary key, as the base table had no primary key.
    I created a trace file for the session and saw references to a column M_ROW$$ in my mview. Nowhere in the data dictionary could I find a reference to the m_row$$ column in my mview, but apparently it exists and is created automatically. After creating the index below, the fast refresh took 6 minutes to add 500k rows to the materialized view. (versus 4+ hours without the index) When I looked in the trace file, I noticed that for each row in the mview log, it first tries to update the mview with an UPDATE statement, then it performs an insert of the new data. Seems like it should be able to determine whether to perform an update or insert based on the DMLTYPE$$ column of the mview log. What was killing my performance was the UPDATE phase. Since I had no primary key on the mview, and no index on the m_row$$ column, the UPDATE phase was performing a full table scan of my mview for every row in the mview log. I was expecting it to be smart enough to only perform inserts, as the only transactions against the base table were inserts.
    In summary: If you have a materialized view without a primary key, create an index on the m_row$$ column of the mview, even though no such column displays in the data dictionary.
    ex:
    CREATE MATERIALIZED VIEW mv_minidrr ...
    CREATE INDEX pk_mv_minidrr ON mv_minidrr(m_row$$) ...

    Well, there indeed is a column called M_ROW$$
    Your MLOG$_EMP is nothing but the materialized view log on the base table.
    SQL> create  materialized view log on emp with rowid ;
    Materialized view log created.
    SQL> create materialized view emp_mview refresh fast on demand with rowid as select * from emp ;
    Materialized view created.
    SQL> desc mlog$_emp
    Name                                                  Null?    Type
    M_ROW$$                                                        VARCHAR2(255)
    SNAPTIME$$                                                     DATE
    DMLTYPE$$                                                      VARCHAR2(1)
    OLD_NEW$$                                                      VARCHAR2(1)
    CHANGE_VECTOR$$                                                RAW(255)
    SQL> select table_name, column_name from user_tab_columns where column_name = 'M_ROW$$' ;
    TABLE_NAME                     COLUMN_NAME
    MLOG$_EMP                      M_ROW$$
    1 row selected.
    SQL>

  • Creating a snapshot without primary keys

    Hi,
    I would like to create a snapshot for a table that does not have a primary key. I've read the thread
    "Re: creating snapshots without a primary key??"
    from Mar 24, 2003, which seems to indicate that this is allowed if the snapshot is not updatable. However, even when I disable the "Updatable?" option, I still get the following error:
    WTG-20502 Packaging Wizard Failed. 500
    CONS-10032: Publication item: WTGPI_10012 cannot
    be updatable, primary keys for xyz.abc not found.
    BTW, the Oracle9i Lite Developer's Guide for Windows 32 is really thin in this area. In particular, the description of the Updatable feature is the following:
    This check box defines the snapshot to be created
    as updatable.
    That description has a lot of unmet potential.
    Thanks,
    Tim

    Hello,
    If you create a snapshot that has no primary key, you have to check the option "complete refresh".
    Oracle uses the primary key to track changes for the "partial refresh" option (only send changes back and forth).
    -Antti Virkkunen, www.vilant.com

  • CDC without Primary Key

    Hi,
    Can we implement Change Data Capture in Oracle 10g without having Primary Key at the source level.
    With Regards,
    Katta

    Hi;
    Can we implement Change Data Capture in Oracle 10g without having Primary Key at the source level.AFAIK yes; Please see
    http://docs.oracle.com/cd/B13789_01/server.101/b10736/cdc.htm#i1025409
    http://en.wikipedia.org/wiki/Change_data_capture
    Regard
    Helios

  • Logical standby and Primary keys

    Hi All,
    Why primary keys are essential for creating logical standby database? I have created a logical standby database on testing basis without having primary keys on most of the tables and it's working fine. I have not event put my main DB in force logging mode.

    I have not event put my main DB in force logging mode. This is because, redo log files or standby redo logfiles transforms into set of sql statements to update logical standby.
    Have you done any DML operations with nologging options and do you notice any errors in the alert.log? I just curious to know.
    But I wanted to know that, while system tablespace in hot backup mode,In the absence of both a primary key and a nonnull unique constraint/index, all columns of bounded size are logged as part of the UPDATE statement to identify the modified row. In other words, all columns except those with the following types are logged: LONG, LOB, LONG RAW, object type, and collections.
    Jaffar

  • Can EJB 3.0 beans be used with tables that do not have a primary key?

    Can a EJB 3.0 persistence bean be used with tables that do not have a primary key defined? I am building a test application based on the HowTo - Building EJB 3.0 Faces App paper posted after Openworld (schalk). The issue I am running into when trying to run the application is: Exception Description: Entity class [class com.persistence.Rpthead] has no primary key specified. Note: I get a simular error when using toplink directly.
    The tables I am binding to do not have primary keys defined. They use unique constraints to manage the table integrity.
    Is it possible to use EJB 3.0 on tables without a primary key? If not, are there plans to support this in the future?

    The spec requires a primary key Id annotation. I will take your suggestion to EJB 3.0 expert group.
    Can you also send an email to [email protected] with your requirement?
    -Debu

  • IOTs and primary keys

    hi,
    I am reading chapter 10 of expert oracle database architecture by tom kyte, and I am getting a little confused. It seems to me as if he is saying that an IOT should be built using the PK of that table. What if our table does not have a PK?
    thanks

    OracleGuy777 wrote:
    hi,
    I am reading chapter 10 of expert oracle database architecture by tom kyte, and I am getting a little confused. It seems to me as if he is saying that an IOT should be built using the PK of that table. What if our table does not have a PK? Then you can not create an IOT. It's a rule. http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/schema.htm#i23877
    One of the suggestions is 'try it'. So let us do exactly that - create 2 nearly idetical IOTs - one with and the second without a primary key
    SQL*Plus: Release 10.2.0.1.0 - Production on Sun Nov 1 11:07:37 2009
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> CREATE TABLE countries_demo
      2      ( country_id      CHAR(2)
      3        CONSTRAINT country_id_nn_demo NOT NULL
      4      , country_name    VARCHAR2(40)
      5      , currency_name   VARCHAR2(25)
      6      , currency_symbol VARCHAR2(3)
      7      , region          VARCHAR2(15)
      8      , CONSTRAINT    country_c_id_pk_demo
      9                      PRIMARY KEY (country_id ) )
    10      ORGANIZATION INDEX
    11  /
    Table created.
    SQL> edit
    Wrote file afiedt.buf
      1  CREATE TABLE countries_demo2
      2      ( country_id      CHAR(2)
      3        CONSTRAINT country_id_nn_demo NOT NULL
      4      , country_name    VARCHAR2(40)
      5      , currency_name   VARCHAR2(25)
      6      , currency_symbol VARCHAR2(3)
      7      , region          VARCHAR2(15) )
      8*     ORGANIZATION INDEX
    SQL> /
        ORGANIZATION INDEX
    ERROR at line 8:
    ORA-25175: no PRIMARY KEY constraint found
    SQL>SO the conclusion is, whether it makes sense to us or not, we can not create a table without defining a primary key.
    It makes sense to me, since the IOT is actually stored as a unique index with nulls not allowed - for which a PK is a perfect fit. Note that a PK COULD be defined with multiple columns instead of the traditional single column (and often wrong surrogate key)

  • Source tables for forms and tabular forms must have a primary key.

    Why does HTML DB 2.0 return the message
    "Source tables for forms and tabular forms must have a primary key."
    when trying to generate a "Report and Form" page based on a view defined like "create view <applicationschema>.a as select * from <sourceschema>.b" ?
    It should be possible for HTML DB to "see" that the table "<sourceschema>.b" already has a primary key.
    bw - Christian

    Christian,
    In the create application wizard, when creating form or tabular form pages, you can only use tables with primary keys, and not views, because that wizard is automatically deriving the primary key from the table definition. If you want to build forms on views or tables without a primary key, you need to use one of the create form wizards while working on an existing application. Those wizards allow you to pick your own column as a primary key column.
    Regards,
    Marc

  • Unable to enforce Primary Key constraint with my code

    Hi Guys
    I have a table that contains 2 columns: code and description (defined as not null). I am using oracle forms 10g, if I inset a new row both the columns: code and description should have data e.g. code: 001 and description: Main Store...
    So on forms I have an on-update trigger on block level that handles the error messages but if the user has to update the description this trigger blocks him because the value for the code i.e. 001 is already on the database but if I remove the piece of code (the first IF block on my code together with a cursor and the entire declaration section)then the primary key constraint is violated: the code is as follows:
    declare
    v_store_code store_types.code%type;
    cursor store_codes is
    select a.code
    from store_types a
    where a.code = :b1.code;
    begin
    open store_codes;
    fetch store_codes into v_store_code;
    if ( store_codes%found ) then
    Message('The Store Code you have entered already exists on the Store_Types table, please enter another code!');
    Message('The Store Code you have entered already exists on the Store_Types table, please enter another code!');
    close store_codes;
    raise form_trigger_failure;
    end if;
    close store_codes;
    if :b1.code is not null and :b1.description is null then
         message('If the Store Code has been captured, then the Store Description must be captured!');
         message('If the Store Code has been captured, then the Store Description must be captured!');
    raise form_trigger_failure;
    end if;
    if :b1.description is not null and :b1.code is null then
         message('If the Store Description has been captured, then the Store code must be captured!');
         message('If the Store Description has been captured, then the Store code must be captured!');
         raise form_trigger_failure;
    end if;
    exception
              when others then
                   message(sqlerrm);
                   raise form_trigger_failure;
    end;
    My main intention here is: the user should be able to update the description field and save the changes without violating primary key on the column: code ...... please help me guys...

    ICM
    Sir as far I could understand , your problem is that your wanna allow the end users to update the Store_description , and Store_code..
    So on forms I have an on-update trigger on block level that handles the error messages but if the user has to update the description this trigger blocks him because the value for the code i.e. 001 is already on the databaseif it's right then why don't you have unique key constraints Store_description?
    alter the tables and apply unique key constraint...
    and no need to write this code
    f :b1.code is not null and :b1.description is null then
    message('If the Store Code has been captured, then the Store Description must be captured!');
    message('If the Store Code has been captured, then the Store Description must be captured!');
    raise form_trigger_failure;
    end if;because as you mentioned
    code and description (defined as not null)if they are already under not null constraints then no need to handle this in coding..
    he/she must be able to change the description and save the changes without affecting the code i.e.:Sir I think updation in records can only be performed when the forms is in query mode e.g execute query, have all/desired records and then make changes
    (1)description is in unique key constraint it can't be duplicated ..
    (2)code is PK it can never be duplicated...
    for this I would suggest you to have a update button on forms , when-button-pressed trigger sets property of block (update_allowed, property_true);
    and check the code of unique key violation code from oracle form's help , when that error code raise up you can show those message
    Message('The Store Code you have entered already exists on the Store_Types table, please enter another code!');
    Message('The Store Code you have entered already exists on the Store_Types table, please enter another code!');I hope it could do something for you
    thanks
    regards:
    usman noshahi

  • Inner join-select -primary key in table issue

    Hi ,
            Iam using FEBKO(header) and FEBEP(item) in inner join  select .But the datas fetching by this selct in not correct.The analysis is the is no common primary fields in the both table.
    Question 1-> Can i use inner join without common primary key in the both tables, weather it possible to make a select without common primary key in both table. Please kindly let me know.
    Question 2-> What is the other possible way to give the selct for both table(better performance)
    Regards,
    Veera

    Hi,
    When you use INNER JOIN in this case, link your tables based on KUKEY and ESNUM fields, bcoz there can be many items under a single header. So this will work for you, even from the performance point of view.
    Hope this is helpful to you. If you need further information, revert back.
    Reward all the helpful answers.
    Regards
    Nagaraj T

Maybe you are looking for

  • Why don't my tags show up when re-saving a document that I previously tagged?

    I love the idea of tags. I use them religiously in Lightroom to organize and recall my photos. The one thing that makes tags ineffective though is the amount of effort it takes to enter them. But being a true believer of the value I do it. That being

  • Depreciation missing for some past months..

    Just now I have noticed that for an asset which has still useful life of 4+ years, has not been depreciated since May 2011.  In 2011, depreciation was posted for January, Feb, March & April.  After that I find another row for Planned depreciation for

  • FI-MM Accounting Entries

    Hi all, The chart of accounts CAIN has the following excise related GL accounts: 24820000 CENVAT Input BED 24920000 PLA on Hold 13113920 Cenvat Clearing 24880000 PLA BED 24930000 Cenvat on Hold 13113910 Cenvat Suspense 24920000 PLA on Hold 13113930 C

  • Synchronizing pictures on ios 6

    Hi! Yesterday I updated my iphone 4 to iOS 6. When I syncronized the iphone all the pictures weren't synchronized. I tried to delete the ipod photo cache but it returned and it didn't work either. Does anybody else have the same problem? Kristina

  • Connection Between Solution Manager and ECC

    Dear Techies,                  I would like to install SAP Solution Manager in one laptop and ECC on another laptop. Both the laptops have very good configuration in terms of operating system (both have server editions) , RAM ( 8GB each) and Hard Dri