Normal Indexes created for Primary/Unique Keys in Oracle8/8i

I remeber prior to Oracle8, when we create a Primary/Unique Key constraints, an unique index will be created by default. But I am noticing now in 8/8i when we create either Primary or Unique key, only normal/simple index is created. We are not able to override this normal index either by dropping and recreating the index alone. I believe it would be pretty much better in case of performance if we have a unique index for this columns. Can anybody help why is it changed so in 8/8i??
Thanks,
R. M.

Dear Rob,
since your answer was helpful and since it was the only one I will grant you full points on that.
Thanks again for your input. In case other developers should look this thread up being confronted
with the same kind of problem, here is how we solved it:
We added an artificial primary key (a number of type NUMC 8) to the table which is supposed to
include the structure. This key alone takes care of the uniqueness of eacht entry.
All the others fields that we want to have available for a fast direct access, including the ones
from the included structure, are put together in a secondary index.
best regards
Andreas

Similar Messages

  • Primary/Unique key for GL_IMPORT_REFERENCES

    Hi all,
    We are on EBS11.5.10. I have the following requirement. I need to put a snapshot log on GL_IMPORT_REFERENCES which we will use to interface data to out reporting environment. Therefore i need to set a primary key on GL_IMPORT_REFERENCES, this is required for creating the snapshot log.
    Can anyone suggest what combination of fields would be unique for this table, as no unique key is set.
    TIA

    mma,
    but do you tie them in with ETL? or they're simply uniqe auto-number-like?
    Thanks
    I just found this:
    http://datawarehouse.ittoolbox.com/groups/technical-functional/informatica-l/re-about-oracle-bi-and-fact-tables-and-image-tables-1515935
    Looks like there's a new methodology for extending the DWH. I'm still looking into this, but I still think auto-numbering ROW_WID is a good idea.
    Mma, perhaps - could you provide me with an example or two to present this change. Thanks

  • Creating an Incremental Unique Key in Transfer Rules Routine

    Hello Experts,
    In my Infosource, I have created a routine in the transfer rules on my infoobject.  I am trying to load my data from a flat file and create a unique key by autonumbering a field in my infosource/datatarget. 
    I am new to ABAP and can not figure out why my code will not return a value...
    Under "Use of Transfer Structure Fields" I chose my field to change only, and entered the following code:
    Under Global Code I declared my counter because I want it to maintain its value during the entire load:
      DATA: COUNTER TYPE I VALUE 0.
    Then in my routine I have the following code:
      COUNTER = COUNTER + 1.
      RESULT = COUNTER.
      RETURNCODE = 0.
      ABORT = 0.
    I expect this to return 1 for the first record, 2 for the second, and so on - therefore giving me a unique key.  Any assistance in my code or other ways to automate this process in BW would be greatly appreciated.
    Thank you.

    Sean,
    It looks like your routine is basically correct.  Have you tried using single quotes around the S instead?  Also - you may want to add a statement to indicate what 0AMOUNT should be in the instance where your condition isn't true.  Something like this:
    IF tran_structure-shkzg  = 'S'.
    RESULT = tran_structure-wrbtr * -1.
    ELSE.
    result = ???
    ENDIF.
    Good luck!  The syntax check in the transfer rules leaves a bit to be desired, doesn't it?

  • Creation of Index for Primary & Foreign Key required?

    hi,
    i would like to find out if a column is defined as the primary key, do i need to create a separate index for it? or defining a primary key will tell the db to automatically create an index for it?
    does foreign key have the same behavior as the primary key constraint?
    thanks!

    i would like to find out if a column is defined as the primary key, do i need to create a separate index for it? No
    or defining a primary key will tell the db to automatically create an index for it? Yes
    See
    http://download-uk.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg05itg.htm#7265
    does foreign key have the same behavior as the primary key constraint?No. See http://download-uk.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg05itg.htm#1574

  • WHat is the best index type for non uniqueness / Varchar columns in SQL 2008 R2

    Hello All Greetings,
    Please help me here with my doubt,
    in my table i have two columns about a million rows, it has about 20 columns in it, three columns with name as Period, Gender so most of the time these two columns use in where clause,
    Gender  will contain Either M or F , Period contains YYYY-Month (2013-December, 2013-August) etc so i would like to add a Index to these two columns so that in will increase the performance, so please let me know what type of indexes i need to add to
    these columns in the table,
    please note that only one time we will add data to the table which will take only 2 minutes but we query the table every day
    so my question what is the best index type that i need to create on columns with non uniqueness values in the column.,
    Thank you In Advance,
    Milan

    There is nothing whatever wrong with creating an index on a VARCHAR column, or set of columns.
    Regarding the performance of VARCHAR/INT, as with everything in a RDBMS, it depends on what you are doing. What you may be thinking of is the fact that clustering a table on a VARCHAR key is (in SQL Server) marginally less efficient than clustering on a monotonically
    increasing numerical key, and can introduce fragmentation.
    Or you may be thinking of what you have heard about writing JOINs on VARCHAR columns - it is true, it is a little less efficient than a JOIN on numeric type, but it is only a little less efficient, nothing that would lead you to never join on varchar cols.
    None of this does not mean that you should not create indexes on VARCHAR columns. A needed index on a VARCHAR column will boost query performance, often by orders of magnitude. If you need an index on a VARCHAR, create it. It makes no sense to try to find an
    integer column to create the index on - the engine will never use it.
    Check this reference: http://stackoverflow.com/questions/14041481/is-it-good-to-create-a-nonclustered-index-on-a-column-of-type-varchar
    Mark ANSWER if this reply resolves your query, If helpful then VOTE HELPFUL
    INSQLSERVER.COM
    Mohammad Nizamuddin

  • Groovy Expression get Values of Unique Key

    Hi all,
    I am trying to create a custom error message for a unique key validation. With other error messages that just evaluate one field I have been able to do things like:
    Value {0} already exists
    With the token for 0 being newValue. When I am validating a unique key when I pull newValue it gives me one of the fields it validates on, is there another expression to get all the values?
    Thanks!
    JDEV 11.1.2.2.0

    hi,
    you can directly use attrName to get the particular attrValue..
    like instead of using newValue using attr FirstName.
    if you want to customize the error message more then you can create entityImpl class and create a method that will return the custom error message i.e you have a method like getErrorMessage() then you can access it like
    adf.source.getErrorMessage().. but i think the first one will solve your problem....
    Regards,

  • Error while creating the Unique Index of the Primary Key of an Item

    Hi all,
    I have deployed a new item (CO_CONTRACTUNIT_PRODUCT) in my publication. The deploy appears to be successfull as the item can be seen in the repository through the Mobile Manager.
    The problem occurs when i sync my local DB to get the item offline. While synchronizing, the following error appears, both in the sync window and the log file ol_sync.log.
    "ERROR",POL-5130,"11/09/2010 11:43:52","table or view %s.%s not found:CO_CONTRACTUNIT_PRODUCT,CO_CONTRACTID,OD_PRODUCTID,CO_CONTRACTUNITID","DB_ROSHNI"
    However, the debug file gives this other error regarding this table.
    ALL_INDEX:CREATE UNIQUE INDEX "TPCO_CONTRACTUNIT_PRODUCT_PK" ON CO_CONTRACTUNIT_PRODUCT (CO_CONTRACTID,OD_PRODUCTID,CO_CONTRACTUNITID) -5130Error at C:\ADE\omeprod_ol103021\olite\db\build\win\ocapi\..\..\..\src\ocapi\allindexes.cpp line:329 rc:-5130
    Build date Mar 29 2010
    okErr=(table or view %s.%s not found)
    mess=(CO_CONTRACTUNIT_PRODUCT,CO_CONTRACTID,OD_PRODUCTID,CO_CONTRACTUNITID)
    AddLog(-5130 "ERROR",POL-5130,"11/09/2010 11:43:52","table or view %s.%s not found:CO_CONTRACTUNIT_PRODUCT,CO_CONTRACTID,OD_PRODUCTID,CO_CONTRACTUNITID","DB_ROSHNI")
    But the index that is being created and is giving the error is the index created automatically with the Primary Key of the table, and so nothing has been modified in that.
    The primary key of the table is created with the three columns that are part of the index that is returning the error.
    As I could not solve the error, I tried to drop and re-create the item in the repository, but no luck. As a last option, i tried to remove the item from the repository to be able to sync properly again (just like before creating the item), but the error still happens.
    Another weird point is that i have tried creating the item in another publication of another database (but with almost equal items), and the item could was downloaded to my local DB without any problem, which makes this problem still more bizarre.
    What can it be?
    Any help would be great!
    Roshni

    have you tried unistalling the client and reinstalling it?
    schema evolution changes are not always handled correctly please check thread:
    Modification of publication item into Mobile Server
    i quote from rekounas instructions:
    If you are just adding a field, you should only have to run the alter publication item API call.
    Here is an old note on schema evolution on different scenarios. The names for the APIs that they use are now deprecated. Use the ConsolidatorManager class and call the method alterPublicationItem("PUBLICATION_ITEM_NAME", "SELECT STMT") :
    A) Add column
    1. Upload all client data. Clients should not add new data until they are told by the administrator to sync again!!
    2. Stop Mobile Server listener
    3. Change the Oracle8i/9i database schema (add column)
    4. Create a Java program to call the Consolidator Admin API AlterPublicationItem()
    5. Start Mobile Server
    6. Execute a sync from the client
    7. The new column should be seen on the client. Use MSQL to check snapshot definitions.
    B) Drop column
    1. Upload all client data. Clients should not add new data until they are told by the administrator to sync again!!
    2. Stop Mobile Server listener
    3. Delete column of the base table in the Oracle database schema
    4. Create a Java program to call the Consolidator Admin API DropPublicationItem()
    5. Create a Java program to call the Consolidator Admin API CreatePublicationItem() and AddPublicationItem().
    6. Start Mobile Server
    7. Execute a sync from the client
    8. The new column should be seen on the cliet. Use MSQL to check snapshot definitions.
    C) Change column datatype
    Changing datatypes in a repliatated system is not an easy task. You have to follow certain procedures in order to make it to work. Use DropPublicationItem, CreatePublicationItem and AddPublicationItem methods from the Consolidator Admin API. You must stop/start Mobile Server listener to refresh the cache.
    1. Client syncs. Clients should not add new data until they are told by the administrator to sync again!!
    2. Stop Mobile Server listener
    3. Drop/create column (do not use conversion procudures) at the base table
    4. Call DropPublicationItem(). Check if the ErrorQueue and InQueue no longer exist.
    5. Call CreatePublicationItem() and AddPublicationItem(). Check if the ErrorQueue and InQueue reflect the new column datatype
    6. Start Mobile Server. This automatically resumes application
    7. Client executes sync. This should drop the old snapshot and recreate the new snapshot. Use MSQL to check
    snapshot definitions.
    D) Drop table
    1. Client syncs. Clients should not add new data until they are told by the administrator to sync again!!
    2. Stop Mobile Server listener
    3. Drop base table
    4. Call DropPublicationItem(). Check if the ErrorQueue and InQueue no longer exist.
    5. Start Mobile Server. This automatically resumes application
    6. Client executes sync. This should drop the old snapshot. Use MSQL to check snapshot definitions.
    E) Add table
    1. Client syncs. Clients should not add new data until they are told by the administrator to sync again!!
    2. Stop Mobile Server listener
    3. Add new base table
    4. Call CreatePublicationItem() and AddPublicationItem() method
    5. Start Mobile Server. This automatically resumes application
    6. Client executes sync. This should add the new snapshot. Use MSQL to check snapshot definitions.
    F) Changing Primary Keys
    Chaning PK is a severe operation which must be executed manually. A snapshot must be deleted and recreated to propagate the changes to the clients. This causes a full refresh on this snapshot.
    1. Client syncs. Clients should not add new data until they are told by the administrator to sync again!!
    2. Stop Mobile Server listener
    3. Drop the snapshot using DropPublicationItem() method o
    4. Alter the base table
    5. Call CreatePublicationItem()and AddPublicationItem() methods for the altered table
    6. Start Mobile Server. This automatically resumes application
    7. Client executes sync. The old snapshot will be replaced by the new snapstot using a full refresh. Use MSQL to check snapshot definitions.
    G) To Change a Table Weight =>
    Follow the procedure below to change the Table Weight parameter. The table weight is used by the Mobile Server/Synchronization to determin the sequence in which client records are applied to the Oracle database.
    1. Run MGP to apply any changes in the InQueue to the Oracle databse
    2. Change table weight using SetTemplateItemMetadata() method
    3. Add/change constraint on the the base table which reflects the change in table weight
    4. Synchronize
    gl m8

  • How to create one primary key for each vendor

    Hi all
    i am doing IDOC to jdbc scenario
    i am triggering idoc from R/3 and the data is going into DB table vendor through XI.
    structures are as follows:
    sender side: ZVendorIdoc (this is a customized IDOC , if i triger IDOC for multiple vendors then it triggers only 1 idoc with multiple segment )
    Receiver side:
    DT_testVendor
        Table
            tblVendor
                action UPDATE_INSERT
                access                     1:unbounded
                    cVendorName         1
                    cVendorCode        1
                    fromdate                1
                    todate                    1
                 Key1
                    cVendorName         1
    if i trigger idoc for multiple vendors ,for example vendor 2005,2006 and 2010 . then i can see that the only key comes from the very first field (2005) and the whole record for vendor 2005,2006 and 2010  goes into the table with this(2005) as a primary key
    now again if i send data for these three vendor 2005, 2006 , 2010, in which record for the vendor 2005 is same and for 2006 and 2010 are different than it takes 2005 as a primary key and it does not update the data in the table.
    my requirement is like this:   for each vendor there should be one unique key assigned.
                                              for above said example there should come three keys one for each vendor .
    could you please help me how to do this???????????

    Hi,
      In Mapping Make the statement is 0-unbounded.For each vendor create a statement.This will solve your problem.
    Regards,
    Prakasu.M

  • Is it possible to create many primary key for a table?

    hello sir/mam.
    i am selva, i am new to abap,
    is it possible to create many primary key for a table?
    please guide me.

    Hi Selva,
    Many Primary Keys = Composite Key.
    i.e some set of columns will enable you to identify a unique row from a set of rows in the table.
    This can be achieved by checking the primary key check box in se11.
    Hope it helps.
    Regards,
    Maheswaran.B
    Message was edited by: Maheswaran B

  • How shall we do validation for Unique Key and Multiple Primary Key?

    Hi,
    I have table created From EO in which one column is checked as Unique.
    How to do validation for column checked as Unique.
    I know how to do validation for column checked as primary key.
    Below is sample code for primary key validation
    if (getRvSize() != null)
    throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
    getEntityDef().getFullName(), // EO name
    getPrimaryKey(), // EO PK
    "RvSize", // Attribute Name
    value, // Attribute value
    "AK", // Message product short name
    "FWK_TBX_T_EMP_ID_NO_UPDATE"); // Message name
    if (value != null)
    OADBTransaction transaction = getOADBTransaction();
    Object[] rvKey = {value};
    EntityDefImpl rvDefinition = xxczVAGCSRVSizingEOImpl.getDefinitionObject();
    xxczVAGCSRVSizingEOImpl rv =
    (xxczVAGCSRVSizingEOImpl)rvDefinition.findByPrimaryKey(transaction, new Key(rvKey));
    if (rv != null)
    throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
    getEntityDef().getFullName(), // EO name
    getPrimaryKey(), // EO PK
    "RvSize", // Attribute Name
    value, // Attribute value
    "AK", // Message product short name
    "FWK_TBX_T_EMP_ID_UNIQUE"); // Message name
    What changes need to be done for above code in order to do the validation for Unique Key.
    I have one more Question
    How shall we do the Validation for Multiple Primary Key in a table?
    - Mithun

    1. If you just validate on one attribute like your unique key, then put your logic in the set<Your AttributeName) method
    2. If you want to do the cross validation ( like validating multiple attributes) then put your logic in the validateEntrity Method
    How to do that?
    1. Create a Validation View object.
    2. Associate your VVO to the VAM
    3. Create entity expert.
    4. Have method in entity expert for your validation (you would be calling AM and then VO execute the query and do the validation.
    5. You would be calling the Entity experty method from your EO either setMethods or validateEntity.
    I have given just the high level points.
    Hope this helps.
    Thanks,
    RK

  • Creating a Primary Key in SSMS without Also Creating a Clustered Index

    In the course of development (SQL Server Express 2012) I’m creating various tables which should not have a clustered index on the primary key. However, it seems as if SSMS is obsessed with always doing so. I cannot seem to find a way through the simple
    “right click on column and select "Set Primary Key" method to stop the creation of an associated clustered index. 
    I can work around it fairly easily by having SSMS generate the necessary script and then changing CLUSTERED to NONCLUSTERED, but I’m curious if there is a way to do it purely using the UI that I’m overlooking…

    To be honest, though, until I get much closer to production and have loaded a lot more data I won't know for sure one way or the other - this was more of an awareness question from my part and something that I could not find anyone ever asking on
    the web.
    To add to what David said, the performance impact in the end depends much on the size of the table size and amount of memory available to SQL Server.  All things being equal, performance will be roughly the same with both sequential and random keys
    as long as data are memory resident. But a random key greatly reduces the likelihood need data will be in memory.
    The worst case scenario for single-row selects is an even distribution of random key values, a very large table, and little SQL Server memory.  Nearly every select query will require a physical I/O in this case.  Since each spinning-media disk
    spindle is capable of only 150-200 IOPS so your throughput will be constrained accordingly.
    A big advantage of sequential key values for single-row selects is improved temporal reference locality.  In practice, the most recently inserted/accessed rows are most likely to be subsequently queried.  A single-row query will not only
    read the requested row, but the adjacent rows on the same page as well, thus avoiding costly I/O for a select of those rows.
    See http://www.dbdelta.com/improving-uniqueidentifier-performance/ for an example of how to generate sequential GUIDs from C# code.
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • Difference between Unique key and Primary key(other than normal difference)

    Hello,
    1).Can any one tell me any other difference between Unique key and Primary key other than it having NULLs.
    2). What is the difference the words 'DISTINCT' and 'UNIQUE' in a sql query.
    Thanks in advance.

    Hi
    If you don't believe me than see the documentation in
    OTN.
    Ott Karesz
    http://www.trendo-kft.hu
    SQL> create table scott.tbl_clob
      2  (sss CLOB)
      3  /
    Tabelle wurde angelegt.
    SQL> insert into scott.tbl_clob values('wrwrwrw')
      2  /
    1 Zeile wurde erstellt.
    SQL> insert into scott.tbl_clob values('wrwrwrw')
      2  /
    1 Zeile wurde erstellt.
    SQL> select distinct sss from scott.tbl_clob
      2  /
    select distinct sss from scott.tbl_clob
    FEHLER in Zeile 1:
    ORA-00932: nicht übereinstimmende Datentypen
    SQL> select unique sss from scott.tbl_clob
      2  /
    select unique sss from scott.tbl_clob
    FEHLER in Zeile 1:
    ORA-00932: nicht übereinstimmende Datentypen
    SQL> select distinct to_char(sss) from scott.tbl_clob
      2  /
    TO_CHAR(SSS)
    wrwrwrw
    SQL> select unique to_char(sss) from scott.tbl_clob
      2  /
    TO_CHAR(SSS)
    wrwrwrw
    SQL>

  • Cannot create DDL for Unique Key

    I have a relational model with a unique key constraint. When I go to Export -> DDL File for my model, and look at the PK and UK constraints tab for "DDL Generation Options", the UK is checked. But upon inspecting the generated DDL file, it is not being generated! The target database in Oracle 11.1 and I am using DM 4.0.3.853.

    Hi,
    Very strange.  Is there anything unusual about the Table or its Unique Key column(s)?
    Is everything else being generated as expected?
    Are there any relevant error messages in the log?  (You can use External Log on the View menu to display the log.)
    David

  • How to create a primary key by 2 columns in sql??

    as title
    thx a lot.

    Chris,
    Well you have two basic ways. One is to issue an alter table command and define a PRIMARY KEY (also called a PK). The other is to create a UNIQUE index. The PRIMARY KEY creates an index anyway, though I prefer to just use unique indexes as you can specify more options in this manner. A table can only have 1 PK where as you can have multiple UNIQUE indexes. I also do not combine the PK definition directly into the CREATE TABLE command, as normally one would keep a seperate PK script, even if they did contain only unique indexes commands and not PK alter table commands.
    Anyway, below are the two methods of making a PK/Unique object for your table. The table name used here is T1 ...
    Method #1 (Primary Key)
    ALTER TABLE T1 DROP PRIMARY KEY;
    ALTER TABLE T1 ADD PRIMARY KEY
    (Column_1,Column_2, ...)
    STORAGE
         NEXT 512K
         MINEXTENTS 1
         MAXEXTENTS UNLIMITED
         PCTINCREASE 0
    Method #2 (preferred) : Unique Index
    DROP INDEX PK_T1;
    CREATE UNIQUE INDEX PK_T1 ON T1
    (Column_1,Column_2, ...)
    TABLESPACE INDX
    PCTFREE 10
    STORAGE
         INITIAL 1M
         NEXT 512K
         MINEXTENTS 1
         MAXEXTENTS UNLIMITED
         PCTINCREASE 0
    It's always best to define the storage clause for both the create table and it's indexes.
    Hope this helps ya,
    Tyler

  • Difference between Unique key and Unique index

    Hi All,
    I've got confused in the difference between unique index & unique key in a table.
    While we create a unique index on a table, its created as a unique index.
    On the other hand, if we create a unique key/constraint on the table, Oracle also creates an index entry for that. So I can find the same name object in all_constraints as well as in all_indexes.
    My question here is that if during creation of unique key/constraint, an index is automatically created than why is the need to create unique key and then two objects , while we can create only one object i.e. unique index.
    Thanks
    Deepak

    This is only my understanding and is not according to any documentation, that is as follows.
    The unique key (constraint) needs an unique index for achieving constraint of itself.
    Developers and users can make any constraint (unique-key, primary-key, foreign-key, not-null ...) to enable,disable and be deferable. Unique key is able to be enabled, disabled, deferable.
    On the other hand, the index is used for performance-up originally, unique index itself doesn't have the concept like constraints. The index (including non-unique, unique) can be rebuilded,enabled,disabled etc. But I think that index cannot be set "deferable-builded" automatic.

Maybe you are looking for

  • How do I record a quicktime screen recording directly to an external hard drive?

    I want to record a screen recording directly to an external hard drive (or flash drive/SD card) and I've heard that doing so will improve system performance by reducing the workload somehow. I'm not entirely sure. Is that true, will it work, and how

  • Netting

    Hi, I have a question regarding netting between customer and vendor. Netting happens in F110 automatically. Does it clear the customer-vendor open items by line items or by balance. For example, Customer has 5 line items totally $3000(debit balance)

  • Very urgent - bdc

    How to transfer the error records from internal table to the excel file in the BDC - Call Transaction method? Thanks in advance

  • Actions and buttons

    Hi I got a button with 3 types of icons. pressed,normal and disabled. I have created an action for the button and i would like to use this action to detrmin if the button is enabled or not (like explianed in: http://java.sun.com/docs/books/tutorial/u

  • LabVIEW and NI Openings - UK

    Hi Everyone, I am a Recruitment Consultant Specialising in the placement of professionals within National Instruments environments in the UK. A few years ago I noticed there was a lack of skilled agents within this environment and I have since built