The index of the primary key in a different tablespace.

Hello

I have a user PROD. It has received a tablespace PROD_TBS default.
There is a separate table for all indexes space in the diagram, PROD_IDX.

I want to create a TEST table as follows,

CREATE TABLE TEST
(TEST_ID, NUMBER (1),)
NAME VARCHAR2 (10));

It must be a primary key on the column test_id, but such that the corresponding unique index created by default because of the primary key must be created in the PROD_IDX tablespace.

How to do this?

Alternative solution:

CREATE TABLE TEST
(TEST_ID NUMBER(1),
NAME VARCHAR2 (10),
constraint test_pk primary key (test_id)
using index tablespace prod_idx
 );

Cheers, APC

blog: http://radiofreetooting.blogspot.com

Tags: Database

Similar Questions

  • Factor of clustering for the primary key Index

    Hi all

    I have cretead a new table with 1.7 million records with an index of primary key on ID (NUMBER)
    Number of blocks used is arnd 57 K.

    Factor value of clustering on the primary key index is 1.6 million.

    Could you please suggest what can be the reason for such a clustering factor high for the new table.


    Thank you
    Ash N.

    Google is your friend:
    http://www.dbasupport.com/forums/archive/index.php/t-38893.html
    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:1032431852141
    http://hemantoracledba.blogspot.com.es/2008/01/impact-of-clustering-factor.html

  • Problem with the primary key and indexes

    Hi all

    I'm looking a mess on one of our main tables.
    One of the developers here added an index on 3 columns in the table, thinking that it would speed up (not noticing that it had not a PK).

    Subsequently another developer has noticed there do not have a primary on key. So they added a touch of primry on the single column.

    The problem is that now the index created on 3 columns is bein used as the primary key index. As when the primary key is created a new index was not created.

    Is there anyway to get rid of this index/change it correct?

    This table is related to many many other tables, so when we tried to remove the index we could not due to the primary key and foreign key violations with other tables.

    Thanks in advance

    Oracle, as you found, is quite capable to use a column enformce multi index a single column primary key, as long as the pk column is the leader in the index. This should not cause performance issues for a search of PK and if the three indexed columns are often selected only may benefit from these types of queries.

    The only way to change that now, would be to drop all CF, drop and add the PK constraint and then add all the FK constraints. A long time and potentially dangerous (if you miss to add back of the FKs) endeavour. Certainly not worth the risk in my opinion.

    John

  • creating a unique index of instaed of using the primary key index

    Hello

    I heard in a debate sometimes it is better to create a unique index on a column and use it instead of using the primary key index in oracle. I did not understand what that the reason propely.

    Can someone please help me in this topic if it is valid.

    Thanks in advance

    On the surface, which does not seem reasonable... Volume of the DML is irrelevent to determine which column is the primary key for a table.

    My wild speculation a bit at a reasonable time could someone do...

    If you use synthetic primary keys (i.e. the keys generated by sequence) and that your tables are subject to large volumes of inserts such as there is a danger that the block "to the right" will be the source of contention block and worry not about analysis of beach on the column, you can create a reverse on this column (unique or non-unique) key index before creating the primary key constraint and to indicate Oracle to use this existing index to respect the primary key constraint.

    Obviously, however, this involves a lot of assumptions to arrive at a reasonable point. There may well be another set of assumptions that could also lead to a valid argument. Or it could be a myth that someone has heard and just repeats.

    Justin

  • How did the foreign key that is recognized by the primary key

    Hi, when I have two user tables and userLevel and the primary key of the user is the user name and I add a field to userLevel userID is only to make the userID field in userLevel automatically the foreign key of the table? Or do you switch the engine of MyISAM tables to InnoDB to make relational links. Can someone please explain this in English clear to me, because I just can't get my head around this.

    In the case of a query such as SELECT statement, we talked, being a key actually means that the field is indexed so that the database can quickly look up.  Thus, in phpMyAdmin, you set the field to be indexed by the visualization of the structure of the table and clicking the icon index (the one with the Lightning) for the field in the Action section.

    If you are looking for integrity refrential between tables we also talked about and using the InnoDB engine, you can click the link 'Show the relational' in the table structure page of phpMyAdmin and define foreign key constraints.

  • APEX do not allow to change the lines of the columns that are the primary key?

    I have pictures:
    http://img508.imageshack.us/my.php?image=21269582oe8.jpg


    Book (id_book - 'Primary key', title, year); book_author (id_author id_book - 'Primary key', - 'Primary key'); author (id_author - "Primary key", name)



    I created a new page-> Form-> form of 'author' table because I want to add new authors, modification and deletion. During the creation of this page, I have chosen column 'id_author' as '1 primary key column' and everything is OK (I can't edit the 'id_author' column - this column is autoincrement and I can change the 'name' column).

    BUT I also created a new page-> Form-> table for table "book_author" because I like to write numbers like id_book and id_author, change and remove them (so add relations between tables: book, book_author and author). During the creation of this page, I have chosen column 'id_book' as '1 primary key column' and 'id_author' as 'column primary key 2'. And on the Web site, I can't edit these fields. And I can not add also new line because I see in each new line: (null).

    http://img444.imageshack.us/my.php?image=11324615yk9.jpg

    APEX do not allow to change the lines of the columns that are the primary key? It's stupid... What can I do?

    Edited by: user10731158 2008-12-20 11:40

    Column unique and not meaningful if you ever want to update. In the case of your example, you need to add an ID column in the intersection of book_author table. Honestly, I was so blown away (and pleasantly surprised) by the absence of rebuttal and the "thx" I advanced and set up an example of how I would define the book_author table:

    create table  book_author
       (id varchar2(32),
        book_id varchar2(32),
         author_id varchar2(32),
         modified_on     date,
         modified_by varchar2(255),
         constraint book_author_pk primary key (id),
         constraint book_auth_book_fk foreign key (book_id) references books(id),
         constraint book_auth_author_fk foreign key (author_id) references authors(id)
         )
    /
    
    create unique index book_author_uq on book_author (book_id,author_id)
    /
    
    create or replace trigger  biu_book_author before insert or update on book_author
    for each row
    begin
         if inserting then
              :new.id := sys_guid();
         end if;
         modified_on := sysdate;
         modified_by := nvl(v('APP_USER'),user);
    end;
    /
    

    Good luck
    Tyler

  • How to find the primary key columns in the tables in MS Access using SQL queries

    How to find the primary key columns in the tables in MS Access using SQL queries

    Hello

    This is the forum for Windows Vista programs related issues.

    For better assistance, please try instead the Forums in SQL Server .

    Thank you! Vincenzo Di Russo - Microsoft MVP Windows Internet Explorer, Windows Desktop Experience & security - since 2003. ~ ~ ~ My MVP profile: https://mvp.support.microsoft.com/profile/Vincenzo

  • Make required error appears only the primary key generated in prior Database Table insert trigger

    Dear all,

    I am a beginner in the ADF and am under Jdeveloper Studio Edition Version 12.2.1.0.0.


    I'm trying to insert a record, I created the trigger for insertion prior to get the primary key and set some other default values.


    On the page, I did read-only primary key column and false required.


    When I try to save - commit (Programmatic), I get errors for the required value. How can I stop this errors.


    Secondly, I also tried changing the agent to disabled on the attribute View object that raised the error below:


    < oracle.dfw.impl.incident.DiagnosticsDataExtractorImpl > < DiagnosticsDataExtractorImpl > < createADRIncident > < incident created 148 to key problem "DFW-99998 [oracle.jbo.PersistenceException] [oracle.jbo.server.RowReference.verifyPrimaryKeys] [Proposals]" >


    Hoping for help.


    Thanks and greetings


    Arif Khadas

    If the primary key values from DB sequence, you can follow this approach:

    Using the sequence of database in ADF - Souza Waslley Blog

    Oracle Fusion Middleware Technologies: ADF 11 G: generate the primary key sequence number

    Otherwise, instead of DB trigger, create the DB function that retrieves the value of the PK and call stored function in the overloaded method create() entity:

  • Houston-25013: too many objects match the [primary key Lookup.USR_PROCESS_TRIGGERS USR_EMP_TYPE] oracle.jbo.Key.

    Hello

    I am trying to open the Console of the IOM of Sysadmin,

    try checking the research,

    search specific "Lookup.USR_PROCESS_TRIGGERS".

    and get the error on the screen

    Houston-25013: too many objects match the [primary key Lookup.USR_PROCESS_TRIGGERS USR_EMP_TYPE] oracle.jbo.Key.

    This known issue?

    This patch it for it?

    tried searching discussion forums, nothing here

    Thank you

    Check from the console design.  Looks like you have a duplicate key Code value.

    -Kevin

  • Comparison of the data of several rows in a table - based on the primary key

    Currently I have a select statement that returns hundreds of records.  Each returned record is linked to A NUMBER of ORDER this order number has a recipe.  (a bit like a cooking recipe).  Each recipe has many records in the database related to this order number and records should be compared to records in a table that bind to a specific primary key...  (I have already developed the logic to isolate what PK I need).  If all these records that are returned by the select statement below does not match all the records containing PK in the table below, I need to get the next PK and compare all these recordings for select statements return.

    See below for a better understanding. Need a good example detailed on how to solve my problem here.

    Just to help you understand:

    Each element of the recipe is 3 parts (side, ref_des, part_number).  1 single recipe can have several parts (where the part_number), and each of these pieces should be placed on the lower side or top of the Board that is there "side" comes into play.  Same thing with Ref_Des.

    What is going on

    Select statement returns the RECIPE of ORDER NUMBER A.  There will be multiple records returned by this query.

    Select the Return statement:

    • Side
    • Ref_Des
    • Part_Number

    Example of return:

    B c17 75145-2

    T f14 89242-8

    B s12 45123-3

    etc,

    In general - what I need to do:

    There is a table called AUTO_RECIPE_DETAILS.  I take all of the records returned by the select query above and compare for each record in this table relating to the recipe 30319-000001.  30319-000001 a number of records.  It is the primary key for a whole recipe as seen above.  This primary key is bound the number of data records in this table.  The comparison is to see if all records under RECIPE_NAME 30319 -000001 match all the records returned by the select statement.

    IF IT DOES NOT MATCH: recover the following recipe in this table below 30319 -000002 and make the same comparison.

    Here's a perfect example of what the table looks like: (AUTO_RECIPE_DETAILS)


    RECIPE_NAME SIDE REF_DES PART_NUM

    -30319-000001 C16 87595-1 B

    -30319-000002           T B14 74150-4

    -30319-000001 T B14 34251-2          

    -30319-000001            T F24 84180-7

    -30319-000002 T B12 13710-8          



    It is the solution to my original question.  By this thread, it's the right answer and I hope this helps someone who is trying to compare two arrays element-by-element.  In the end, the advice given in this thread were correct and I will be using all of your suggestions and the scrapping of this.  Thank you everyone for your help though.

    FOR index_p IN pid_recipe. FIRST... pid_recipe. LAST

    LOOP

    Result WHEN the OUTPUT = 1;

    FOR index_d IN details_recipe. FIRST... details_recipe. LAST

    LOOP

    IF (pid_recipe (index_p). SIDE = details_recipe (index_d). SIDE)

    AND (pid_recipe (index_p). REF_DES = details_recipe (index_d). REF_DES)

    AND (pid_recipe (index_p). PART_NUM = details_recipe (index_d). PART_NUM)

    THEN

    EXIT;

    ON THE OTHER

    DBMS_OUTPUT. Put_line("IT WAS NOT a MATCH");

    result: = 1;

    EXIT;

    END IF;

    END LOOP;

    END LOOP;

    DBMS_OUTPUT. Put_line('LOOP OUT');

  • generate a numerical value to use as the primary key

    Can someone correct me, in an interview that the question was asked.

    How not one generates a numeric value to use as the primary key?

    Years

    We can get it using the sequence. For example:

    CREATE SEQUENCE cust_seq

    START BY
    1000

    INCREMENT OF
    1

    NOCACHE

    NOCYCLE;

    Hi Shu,

    sequence would be my choice and 12 c new type called identity.

  • How to fill out the table foreign key to the primary key form

    Hi all

    I'm stuck in this problem for 3 days, and I'm about to research and implement solutions on the internet.

    I have two tables

    create table prim (a number primary key, b varchar2 (100));

    create table CHILD (a number references (a) prim, varchar2 (100)) c;

    I created a page for PRIM table.

    = page name form on PRIM2

    I have manually two columns for the CHILD table to know

    P26_A_1 (for the primary key in the CHILD table)

    P26_C (for the column in the CHILD Table c)

    now when the user clicks on the button CREATE, a row must be inserted into the child table.

    I want to assign the P26_A to P26_A_1 during the validation process, so that a line must be inserted into the PRIM table as well as in the CHILD table.

    How to do this?

    I downloaded my application page in https://apex.oracle.com

    my workspace identifiers are inferior to

    name of the workspace = IMBERT

    username = demo

    password = demo

    kindly guide me.

    Thank you.

    Hello

    I created a new page (page 30) similar to your page and added the insertion of the child. It just check the page and code. It works now, when you insert the prim file is triggered a second trial which inserts the child record manually.

    On page 26 it was some sort of mistake, was easier to create a new as it was almost a standard form.

    Concerning

    Bottom

  • How to refer to the primary key column of newly inserted rows of tabular form

    Hello

    I use APEX 4.2.0.00.27 with Oracle DB 11.2.0.3.0.

    I work with a tabular presentation wizard-created for insert and update a table using the integrated SRM process (sequence 10).  I'm trying to use a process of anonymous block of PL/SQL (sequence 30) to make another manipulation of table after the records were inserted or updated.  The manual process is associated with my tabular form and I use the variables of name of column binding in my program block.

    My (rsn_test) table has 3 columns: test_id (number), test_nbr (number), test_id2 (number).  Test_id column is identified as the primary key and the type of the source already exists a sequence rsn_test_seq.  Column test_id2 gets its default value 0 to a hidden page element.

    I would use my manual process for updating the value of the test_id2 column.  If it's 0 then I want to put the value of the column test_id.  If it is any other value, then it must remain at this value.  My logic works very well for an existing line, but I'm running into a problem with the newly added lines.  The new lines get inserted, but the test_id2 column remains the default value 0.  I can tell the debugger that the SRM process is triggered first and inserts the line, then my manual dealing with fires.  The problem seems to be that the connection variable: TEST_ID for the primary key column remains NULL after insertion.  I don't know how to get the value of the column test_id of my newly created line to use in my PL/SQL block to my update.

    Process of PL/SQL:

    DECLARE
    BEGIN
       :P7_SHOW := NULL;
       :P7_SHOW := NVL(:TEST_ID2,555) || ' and ' || NVL(:TEST_ID,787) || ' and ' || NVL(:TEST_NBR,9999);
       IF :TEST_ID2 = 0 AND :TEST_ID IS NOT NULL THEN
          UPDATE rsn_test
             SET test_id2 = :TEST_ID
           WHERE test_id = :TEST_ID;
       ELSE
          :TEST_ID2 := :TEST_ID2;
       END IF;
    END;
    
    

    Excerpt from the debugger:

    0.01625 0.00010 Processes - point: ON_SUBMIT_BEFORE_COMPUTATION
    0.01635 0.00008 Branch point: Before Computation
    0.01643 0.00003 Process point: AFTER_SUBMIT
    0.01646 0.00022 Tabs: Perform Branching for Tab Requests
    0.01668 0.00008 Branch point: Before Validation
    0.01676 0.00024 Validations:
    0.01700 0.00135 Perform basic and predefined validations:
    0.01835 0.00020 Perform custom validations:
    0.01855 0.00049 ...Validation "TEST_NBR must be numeric" - Type: ITEM_IS_NUMERIC
    0.01904 0.00007 ......Skip for row 1 because row hasn't changed
    0.01911 0.00016 ......Skip for row 2 because row hasn't changed
    0.01927 0.00012 ...Validation "TEST_ID2 must be numeric" - Type: ITEM_IS_NUMERIC
    0.01939 0.00007 ......Skip for row 1 because row hasn't changed
    0.01945 0.00018 ......Skip for row 2 because row hasn't changed
    0.01964 0.00005 Branch point: Before Processing
    0.01968 0.00004 Processes - point: AFTER_SUBMIT
    0.01972 0.00588 ...Process "ApplyMRU" - Type: MULTI_ROW_UPDATE
    0.02560 0.00154 ...Execute Statement: declare function x return varchar2 is begin begin for c1 in ( select "RSN_TEST_SEQ".nextval pk from sys.dual ) loop return c1.pk; end loop; end; return null; end; begin wwv_flow.g_value := x; end;
    0.02714 0.00140 ......Row 3: insert into "APPPCSRSN"."RSN_TEST" ( "TEST_ID", "TEST_NBR", "TEST_ID2") values ( :b1, :b2, :b3)
    0.02854 0.00011 ...Process "ApplyMRD" - Type: MULTI_ROW_DELETE
    0.02865 0.00004 ......Skip because condition or authorization evaluates to FALSE
    0.02869 0.00015 ...Process "Process Submit" - Type: PLSQL
    0.02884 0.00007 ......Skip for row 1 because row hasn't changed
    0.02891 0.00012 ......Skip for row 2 because row hasn't changed
    0.02903 0.00012 ......Process row 3
    0.02915 0.00429 ...Execute Statement: begin DECLARE BEGIN :P7_SHOW := NULL; :P7_SHOW := NVL(:TEST_ID2,555) || ' and ' || NVL(:TEST_ID,787) || ' and ' || NVL(:TEST_NBR,9999); IF :TEST_ID2 = 0 AND :TEST_ID IS NOT NULL THEN UPDATE rsn_test SET test_id2 = :TEST_NBR WHERE test_id = :TEST_ID; ELSE :TEST_ID2 := :TEST_ID2; END IF; END; end;
    0.03344 0.00013 ...Session State: Saved Item "P7_SHOW" New Value="0 and 787 and 1300"
    0.03356 0.00004 Branch point: After Processing
    0.03360 0.00048 ...Evaluating Branch: "AFTER_PROCESSING" Type: REDIRECT_URL Button: (No Button Pressed) Condition: (Unconditional)
    0.03407 0.00013 Redirecting to f?p=290:7:8717971109610:::::&success_msg=0%20row(s)%20updated%2C%201%20row(s)%20inserted.Success%2FEBD244168556408CBA714E3974918C09%2F
    0.03420 0.00012 Stop APEX Engine detected
    0.03432 0.00007 Stop APEX Engine detected
    0.03439 - Final commit
    
    

    Any suggestions?

    I have run tests on

    https://apex.Oracle.com/pls/apex/f?p=83488:1 demo/demo

    to see your problem.

    I have 2 solution for your problem.
    I add trial NOT tabular just usual block of PL/SQL

    BEGIN
    I'm IN (SELECT TEST_ID FROM RSN_TEST WHERE TEST_ID2 = 0)
    LOOP
          UPDATE RSN_TEST
             SET test_id2 = TEST_ID
           WHERE test_id = i.TEST_ID;
      END LOOP;
    END;

    and works very well, you can see in the sample.

    The other solution is to show new generated TEST_ID

    Adding a sequence as a default value for a column in a table field

    And to execute your procedure.

    I get how is with the good luck of time.

    By

  • How to generate the primary key element and move to another page?

    How to make the primary key value to another page in a table?

    Form on T_ITEMS 2.png

    Hello

    I am a beginner in the apex,

    Please, now I want to add the primary key to page 1 for item id in page 2...

    Notice:

    Before, I created (process of pl/sql in the rendering of page @ after the header section) to get the id of secuance.

    BEGIN
    :P17_ID := seq_t_items_id.NEXTVAL;
    END;
    
    
    

    primary key is generated for the element ID of page 1... BUT When I update 'page 1' I see error and solved when shut down my browser and open it again...

    Please help me to...

    1. Generate a primary key (article id @ page 1)... without refresh error. ?
    2. Pass him (item_id) on page 2

    Thank you all for...

    Sorry I'm beginner in apex,

    I don't know how Pass value of the item_id TO page 1 page 2 "in the form ID", turn to the first PHOTO... .
    Help me..

    Thank you

  • How to extract the values of the line full in the bean to support using the primary key

    Hello

    I have a table that has columns as plant_name, business planner email id and identification of email resident engineer. Here, Plant_name is the primary key.

    Now, I have this plant's name slipped and dropped like selectonechoice (drop) on page jsff. In this user can select any name of 1 plant drop down.

    Right now, I can go get plant in backing bean name, but I can't understand how business plan for extraction and identification of email of the engineer resident in this key primary-plant_name at the bean to support.

    Please let me know if anyone has an idea in this regard.

    JDeveloper version 11.1.1.6.0

    Thanks in advance.

    Sneha

    Sneha211 wrote:

    On the jsff page

    required = "#{bindings." Plant.hints.Mandatory}.

    shortDesc = "#{bindings." Plant.hints.ToolTip}.

    ID = "soc1" unselectedLabel = "- Select -"

    autoSubmit = 'true '.

    Binding = "#{backingBeanScope.backingbean.plantbean}" > "

    ID = "si1" / >

    In backing bean

    DCBindingContainer = lBindingContainer

    (DCBindingContainer) BindingContext.getCurrent () .getCurrentBindingsEntry ();

    DCIteratorBinding lBinding = lBindingContainer.findIteratorBinding("SupplierVO1Iterator");

    NewRow row = lBinding.getCurrentRow ();

    String aamplant1 = (String) newRow.getAttribute ("Plant");

    Hi Sneha, you've written code for it

    you have found the current line and the primary key then this line, then why you not not using this same rank to get the other attributes?

    NewRow row = lBinding.getCurrentRow ();

    String aamplant1 = (String) newRow.getAttribute ("Plant");

    String businessPalnner = (String) newRow.getAttribute ("business_planner"); Returns the value of the same line

    Engineer in String = (String) newRow.getAttribute ("engineer");


    OR if your condition is like that-

    you have a primary key field value, but you do not have the corresponding line, then you can get that line and it's attribute by using the primary key value

    See - http://adfgouravtkiet.blogspot.in/2012/10/filtering-of-data-from-vo.html

    Hope it helps

    -Ashish

Maybe you are looking for

  • HP C309a: Problem w C309a printer

    Hi, I hope someone can help me... I have not had problem with my printer years now since download for windows 10 months ago. I've uninstalled and reinstalled the software and the drivers several times but always seems to be a problem of system commun

  • text in word / excel / wordpad does not print

    Hello, I bought a printer 'HP deskjet advantage ink' a year back, and until now, it was absoluetly work very well. Not sure if any operating system or Microsoft Office update has screwed up. Everything seems fine - printer is offline, print poster ok

  • help with error 2502,2503

    When I download windows SDK for 8 or more as the current version of Skype, I get an error 2502. I face this error all the time, but everything I have tried does not work. like the one where you msicexe/unreg...or one you go in clean boot... it does n

  • Can't access some secure sites using any browser on windows 7

    Hi, I can't connect to hotmail from microsoft and a few other sites secured using any browser (tried ie, chrome and firefox). I can access these sites on my phone symbian on the same wifi network. On my pc, however, I could connect to the microsoft a

  • How to configure Classic Mode ADG excerpt?

    HelloWe have a 11.2.0.2 Prod and Eve physical and physical standby database is in Active mode Datgaurdsys@TMOP:SQL > SELECT database_role, open_mode FROM v$ database;DATABASE_ROLE OPEN_MODE---------------- --------------------PHYSICAL READ EVE ONLY T