Help with primary key in table

Hello

I created a table in Oracle and it filled with information, but I need a primary key (such as an AutoNumber in Access) to identify each record. How can I do this for an existing table?

Thanks much for any help you can provide!

Hello

You can leave down the old sequence and then create a new, or same but make sure that the sequence must be referenced in the trigger to generate IDs.

drop sequence ;

Let me know if its works for you or not.

concerning

Published by: OrionNet on March 9, 2009 20:50

Tags: Database

Similar Questions

  • ORA-02266: permit to unique/primary keys in table referenced by foreign keys

    Hello
    I'm trying to delete data from a table by dropping a partition. I've identified all the child tables by running the following command.

    Select "select count (*) from ' |" table_name |' where employee_id = 100; »
    of dba_constraints
    where constraint_type = 'R '.
    and r_constraint_name in
    (select constraint_name from dba_constraints
    where constraint_type in ('P', 'U') and table_name =' EMPLOYEE);


    "SELECTCOUNT (*) OF | TABLE_NAME | "WHEREEMPLOYEE_ID_ID = 100; »
    -----------------------------------------------------------------------------------------------
    Select count (*) in the PT_ORDERS where employee_id = 100;
    Select count (*) in the PT_DEP where employee_id = 100;
    Select count (*) in the PT_SKILLSET where employee_id = 100;

    I dropped the score for number 100 in all child tables. The count (*) select returns 0 rows for each of the foregoing.

    When I try to run the command on the EMPLOYEE table, below I get ' ORA-02266: unique/primary keys in table referenced by foreign keys enabled.

    Drop partition ALTER table EMPLOYEE EMP_ID_100;

    I don't see why I am unable to give up this partition now because it is data child present in any of the referenced tables. Any suggestions or help on this would be greatly appreciated.

    Thank you.

    RGS,
    Rob

    You must first disable foreign key constraints and delete the partition. Deletion of lines or a fall in childs partitions do not work in this case
    as you have the overall dependence:


    SQL > create table scott.t (x int primary key, int y)
    2 partition by (list (y)
    3 values p_1 (1) partition, partition values p_2 (2))
    4.

    Table created.

    SQL > create table scott.t_c (x int references scott.t (x), int y)
    2 partition by (list (y)
    3 values p_1 (1) partition, partition values p_2 (2))
    4.

    Table created.

    SQL > insert into scott.t values (1,1)
    3 N

    1 line of creation.

    SQL > insert into scott.t values (2,2)
    3 N

    1 line of creation.

    SQL > insert into scott.t_c values (1,1)
    3 N

    1 line of creation.

    SQL > insert into scott.t_c values (2,2)
    3 N

    1 line of creation.

    SQL > commit;

    Validation complete.

    SQL > alter table scott.t_c drop partition p_2.

    Modified table.

    SQL > alter table scott.t drop partition p_2.
    ALTER table drop partition p_2 scott.t
    *
    ERROR on line 1:
    ORA-02266: permit to unique/primary keys in table referenced by foreign keys

    SQL > select constraint_name from dba_constraints
    2 where owner = 'SCOTT' and constraint_type = 'P '.
    3 and table_name = 't';

    CONSTRAINT_NAME
    ------------------------------
    SYS_C0011058

    SQL > select constraint_name from dba_constraints
    2 where owner = 'SCOTT' and constraint_type = 'R '.
    3 and r_constraint_name = "SYS_C0011058";

    CONSTRAINT_NAME
    ------------------------------
    SYS_C0011059

    SQL > alter the constraint to disable scott.t_c table SYS_C0011059;

    Modified table.

    SQL > alter table scott.t drop partition p_2.

    Modified table.

    SQL > alter table scott.t_c enable novalidate constraint SYS_C0011059;

    Modified table.

    I guess you should consider options such as partitioning Referencial (with some restrictions).

    Best wishes
    Dmitry.

  • ORA-02449: unique/primary keys in table referenced by foreign keys

    SQL > create table empinformation
    () 2
    primary key pk_empinformation number (6) 3 forced mobileno
    4 address varchar (100),
    5 salary number (10),
    6 personalid varchar (10) constraints fk_employees_section references employee (emp_id));

    Table created.


    SQL > drop table empinformation;

    ORA-02449: unique/primary keys in table referenced by foreign keys

    solution

    This error happens when the foreign key of a table is referenced by the primary key of the other table.

    If you want to remove the table had refernce key then, you must
    need to remove this table with the foreign key is referenced.

    or

    SQL > drop table EMPLOYEE CASCADE CONSTRAINTS;
    Deleted table.

    This will remove the table parent without droping the child table.

    Published by: Ritesh Singh October 3, 2011 14:04

  • How to delete several lines in the details Table with PRIMARY KEY = ("VID", "LINEITEM")?

    Mr President

    My worm Jdev is 12.2.1.

    I have master tables / details.

    I have 2 lines for each PRIMARY KEY = ("VID", "LINEITEM") as below in the Details table.

    delete.png

    Please help how to get a button on a jsf page to remove these two lines at a time.

    Concerning

    So, in your app (data model) module, you have a master relationship / typical retail:

    And the relationship between them is based on some ViewLink

    Now go to the ViewLink, relationship, accessor.

    Take a look at the Destination accessor.

    Generate accessor object to check and give a name Acessor

    Then go to the master VO, Java and Include accessor, the class generate a display line:

    Go to the class view Java generated line, you'll find a method with the name of the accessor of the previous step, in the form of:

    public RowIterator getYourDetails...or_whaterever_IsAccessorName..() {
    }
    

    Now, in the same Java class, write the following Java method:

    public void removeDetails(){
      RowIterator details = getYourDetails...or_whaterever_IsAccessorName..(); // it is RowIterator over all details
      Row r = details.first();
      while (r != null) {
          r.remove();
          r = details.next();
      }
    }
    

    This method on the Cilent export line Interface:

    Finally, pass the data controls and drop this operation on the form as a button...

  • Update a table with primary key

    Hello

    I have a table called Temp

    CREATE TABLE TEMP
    (
       A   VARCHAR2 (50 CHAR),
       B   VARCHAR2 (50 CHAR),
       C   VARCHAR2 (50 CHAR),
       D   VARCHAR2 (18 CHAR),
       E   DATE,
       F   NUMBER,
       G   VARCHAR2 (18 CHAR),
       H   FLOAT
    );
    

    The primary key is the PRIMARY KEY: (A, B, C, D, E, F, G).

    I HAVE THE TEMPORARY TABLE 48052365 COUNTY,

    HOWEVER I HAVE A REQUIREMENT TO UPDATE WHERE E (COLUMN) IS WEDNESDAY, THE SAME DAY IN MONDAY (I.E., C - 2 TO EXISTING DATE)

    Approach;

    I CREATED the TABLE TEMP_WED_TO_MONDAY AND SELECTED ALL THE RECORDINGS ELIGIBLE IN CE AND TABLE AND INDEX UNIQUE CREATED on this SUBJECT. TO UPDATE, I WROTE UNDER ANONYMOUS BLOCK.

    Number of Tables: TEMP_WED_TO_MONDAY is 46,921,912 and count of total of the table is 48052365

    Anonymous block:

    DECLARE
       CURSOR UPDATE_TEMP_DATE
       IS
          SELECT A,
                 B,
                 C,
                 D,
                 E,
                 F,
                 G,
                 E - 2 NEW_E
            FROM TEMP_WED_TO_MOONDAY;
    
    
       TYPE UPDATE_TEMP_DATE_REC IS RECORD
       (
          A       VARCHAR2 (50 CHAR),
          B       VARCHAR2 (50 CHAR),
          C       VARCHAR2 (50 CHAR),
          D       VARCHAR2 (18 CHAR),
          E       DATE,
          F       NUMBER,
          G       VARCHAR2 (50 CHAR),
          NEW_E   DATE
       );
    
    
       TYPE UPDATE_TEMP_DATE_TBL_TYPE IS TABLE OF UPDATE_TEMP_DATE_REC;
    
    
       UPDATE_TEMP_DATE_TBL   UPDATE_TEMP_DATE_TBL_TYPE;
    BEGIN
       OPEN UPDATE_TEMP_DATE;
    
    
       LOOP
          FETCH UPDATE_TEMP_DATE
             BULK COLLECT INTO UPDATE_TEMP_DATE_TBL
             LIMIT 1000000;
    
    
          EXIT WHEN UPDATE_TEMP_DATE_TBL.COUNT = 0;
    
    
          FORALL I IN UPDATE_TEMP_DATE_TBL.FIRST .. UPDATE_TEMP_DATE_TBL.LAST
             UPDATE TEMP
                SET E = UPDATE_TEMP_DATE_TBL (I).NEW_E
              WHERE     A = UPDATE_TEMP_DATE_TBL (I).A
                    AND B = UPDATE_TEMP_DATE_TBL (I).B
                    AND C = UPDATE_TEMP_DATE_TBL (I).C
                    AND D = UPDATE_TEMP_DATE_TBL (I).D
                    AND E = UPDATE_TEMP_DATE_TBL (I).E
                    AND F = UPDATE_TEMP_DATE_TBL (I).F
                    AND G = UPDATE_TEMP_DATE_TBL (I).G;
    
    
          COMMIT;
       END LOOP;
    
    
       CLOSE UPDATE_TEMP_DATE;
    END;
    
    

    But for the past 6 hours, it only updated records 20,00,000(Twenty lakh) only. because this update in the table and is also part of the teaching primary key I think it takes time, but pointers to improve/acceleration of the update

    Explain the plan:

    update statement all_rows (Cost 4)
      3 update hr.temp 
        2   table access by index rowid table hr.temp (Cost 4, Bytes : 64 ,Cardinality 1)
          1    index range scan index hr.temp_wed_to_monday (Cost 3: Cardinality 1)
    

    Thank you guys, I would be grateful if someone provides the solution for the scenario, rather than highlight the design. Please understand someone designed to best with whatever the limits it has during this period. (and this isn't me).

  • Primary key for tables

    Hi guys,.

    I had a simple order form when you add products.

    So I had 2 tables, ORDER (order_id, order_date) and ORDER_ITEMS (order_id, product_id, product_qty)

    My ORDER_ITEMS are added through tabular form
    select * from ORDER_ITEMS WHERE ORDER_iD = :P21_ORDER_ID;
    I can't create a 1 time order, as I create the ORDER first to get the primary key to add to ORDER_ITEM. I tried the Return key in point and placed the DML above the ApplyMRU process. But no luck.

    THE P21_ORDER_ID is display only save session state.

    Bit at a loss how to create both and to order and add its items in a single time instead of creating the order first then order items. Anyone know how I can accomplish this?

    Return key point seems to be the solution for this but I can't get it to work. Thank you very much.

    Take a look at your request, I changed the driver to the new process page, products and create an order which returns the primary key. Now you can create the initial product registration with in the process. do not disable the multirow process that always allows you to add or update records.

  • How to insert multiple lines in viewobject with primary key?

    Hello

    I use Jdeveloper 11.1.1.3.0 version.

    I create object entity based on the table of the database that have primary keys.
    I created the view on this entity object. I created an array of viewobject, with CreatInsert button and my primary key in the table may while the new record is added.

    Now my problem is that I have created several rows by pressing CreateInsert Button several rows of time are created and displayed in the table. I insert data in all columns of all rows when I click on the submit button (who have the Action "# {bindings.Commit.execute} ') will save data of any 1 line not all data line.

    How can I save all the lines that is created in a single transaction?

    Thanks in advance
    Amit

    Amit,

    I just tried this (all by default, no code written), and he recorded all of the lines. It must be something unique to your application. Michael asks a lot of questions.

    John

  • Primary keys in Tables Oracle EBS Standard

    Hello! I was checking a few standard EBS tables and I just found it odd that there is no primary keys in the columns which (I think) should be the primary key:

    an exaple:

    AP_INVOICE_LINES_ALL DESC;

    Column nameIDPKNull value?Data typeBy defaultHistogram
    INVOICE_ID1NNUMBER (15)Yes
    LINE_NUMBER2NNUMBERYes
    LINE_TYPE_LOOKUP_CODE3NVARCHAR2 (25 bytes)Yes
    REQUESTER_ID4THERENUMBER (15)Yes
    DESCRIPTION5THEREVARCHAR2 (240 bytes)Yes
    LINE_SOURCE6THEREVARCHAR2 (30 bytes)Yes
    ORG_ID7THERENUMBER (15)NULL VALUEYes
    LINE_GROUP_NUMBER8THERENUMBERYes
    INVENTORY_ITEM_ID9THERENUMBERYes
    ITEM_DESCRIPTION10THEREVARCHAR2 (240 bytes)Yes
    SERIAL_NUMBER11THEREVARCHAR2 (35 bytes)Yes
    MANUFACTURER12THEREVARCHAR2 (30 bytes)Yes

    GL_CODE_COMBINATIONS DESC;

    Column nameIDPKNull value?Data typeBy defaultHistogram
    CODE_COMBINATION_ID1NNUMBER (15)Yes
    LAST_UPDATE_DATE2NDATEYes
    LAST_UPDATED_BY3NNUMBERYes
    CHART_OF_ACCOUNTS_ID4NNUMBER (15)Yes
    DETAIL_POSTING_ALLOWED_FLAG5NVARCHAR2 (1 byte)Yes
    DETAIL_BUDGETING_ALLOWED_FLAG6NVARCHAR2 (1 byte)Yes
    ACCOUNT_TYPE7NVARCHAR2 (1 byte)Yes
    ENABLED_FLAG8NVARCHAR2 (1 byte)Yes

    I checked 11i and R12 versions of our Tables to EBS, but both contain primary keys.

    Is this normal or just tell set primary keys?

    Please notify.

    Thank you!

    PS.* I'm trying to settle our scripts and he is still running a full table scan, because it doesn't have a primary key.

    Hello

    This is the standard installation done by oracle at time of installation of EBS in your organization therefore does not necessarily create a new primary key or an index

    on the table.

    The key primary is a combination of unique key constraint not null, and if you look at the script or the definition of the table, you will get the already

    Ed configuration not null not forced and a unique index on some of the columns required by oracle.

  • HP 15 - ac043tu: need help with the key feature and WiFi Drivers

    Hi team,

    I try to activate the key feature and WiFi in my new HP 15 - ac043tu laptop.

    I use Windows 7 Ultimate 32 operating system.

    I installed all the drivers available on the site Web of HP (http://support.hp.com/us-en/drivers/selfservice/HP-15-ac000-Notebook-PC-series/7771404/model/8326116... for my product.

    To activate the function key, I installed driver: HP System Event Utility - sp71716, but it doesn't seem to work.

    In Device Manager, network controller shows exclamation as shown below. I tried to install Broadcom and Realtek WLAN drivers, tried to turn on/off, uninstalled/reinstalled drivers referring to other positions, but that did not work.

    I also tried to install HP SoftPaq Download Manager, but it did not help. Tool does not show my product described.

    I went through a similar question posted by other members, but failed to get the solution. This question gave me hard times.

    Appreciate your help in this regard.

    Thank you

    Kishan

    Hello:

    You need these drivers wireless and bluetooth driver 64-bit file should have the 32-bit drivers too.

    Network controller (wireless card):

    FTP://FTP.HP.com/pub/SoftPaq/sp71501-72000/sp71528 .exe

    Bluetooth:

    This package contains the Broadcom bluetooth driver and software for the laptop models running a supported operating system. Broadcom Bluetooth 4.0 driver is required to activate the bluetooth 4.0 Broadcom devices and is compatible with Broadcom bluetooth 3.0 and earlier versions.

    File name: sp71440.exe

    Unfortunately, I can't help you with the next question.  The system of the event utility would be the only software I can think that would have worked.

    You can try the software HP Quick Launch, but I doubt it will work.

    http://h20565.www2.HP.com/hpsc/SWD/public/detail?swItemId=ob_112835_1

  • Help with the cluster in table for the cluster size difference, please!

    I will admit to still hurt with the berries of LabVIEW, and as usual, the behavior in the vi attached is meaningless to me!  The attached vi shows a cluster 6 element being converted into a table, then immediately to a cluster.  The reconstructed cluster has 9 elements, even if the table size indicator display properly 6.  How to maintain the initial cluster size when converting to and then since then, a table?

    The f

    Well, if you have worked with context-sensitive help running you would see:

    "With the right button of the function and select the Size of Cluster in the context menu to set the number of items in the cluster."

    The default is new. The maximum cluster size for this function is 256. »

    You must set the size. There is no way for the function to know how many elements in the table.

  • Need help with the key "Reg" {EEC5AD98-8080-425F-922A-DABF3DE3F69A}

    My PC works fine but I am getting a bunch of disks "Unknown" in the Device Manager

    This happened after I amazed the contents of the registry key:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\ {EEC5AD98-8080-425F-922A-DABF3DE3F69A}

    Yes Yes I know, my fault to not backup... I tried a solution to USB MTP device error and I did it wrong.

    Now, all this shows is (default) REG_SZ (value not set)

    The subkeys (0000-0010) are very good, because I don't mess with those. But the main key {EEC5AD98-8080-425F-922A-DABF3DE3F69A} is missing its data.

    I was wondering if someone could post their content for this key?

    I don't want to do a complete reinstallation of the operating system because it seems to me a lot for such a small thing.

    Any help would be greatly appreciated.

    I suspect that you need move on to a more robust way of using Windows by
    (a) restoration of the fastening system facilities. He must show a lot of restore points.
    (b) manually create a Restore Point before of playing with the registry instead of fixing thingslater .

    Here are two methods more to repair the damage:

    • Manually restore the backup of the registry. You will find it here: C:\Windows\System32\config\regback\system. Check the timestamp of the file. If it is old enough, save it immediately elsewhere then post to know how to use. He could get crushed any time!
    • Import the registry file below. No guarantee that it will work and some descriptive fields are in German.

    REGEDIT4
    (deleted)

  • Reinstalled Windows after accident, need help with product key

    Original title:

    What sanctimonious group of the so-called 'AID', we have tended to meet with members of the staff of windows.

    I recently had to install all the programs/info after my PC at home.

    Fortunately many of my documents/pictures etc was backed up.

    I have also re install Windows 7. Home premium - which came with the PC when I bought it new.

    Keep the packaging product keys /... for 5 years, OF COURSE NOT!

    Mr. self - rightous "how further I can help you today" Microsoft informs me that EVERYONE KNOWS to keep this info;

    I told him I hope he has ability to view and the brain at my age to remember or be able to do the task himself.

    Of course if I want to 'gift' of Microsoft will be free of charge another $40 to give me another product number.

    Allowing paid once in the fourth, it's a computer at home, I have the drive, it used to work fine, I never use a Word sometimes ~

    I can't be bothered; I'll explain to you just for the little girl that GUYS at microsoft has taken their photo / i.e. screensaver.

    Have anice day :)

    Have you checked the side or the bottom of your box for a laptop at the bottom or inside the battery case the product key.

    J W Stuart: http://www.pagestart.com

  • Help with permission of external table

    Hello world

    I use OBIEE 11.1.1.6.

    I have installation MSAD authentication via RPD and each user is able to connect to Analytics.

    And there is an external table in the database where I have all the users and their groups (all users in MSAD are in this table)

    I created the called session variable GROUP so that these groups of users for approval.

    I have created groups on the front with accurate names appearing in the external table.

    But I can not configure the required privileges

    each user is to see all the reports and the subjects.

    I have to create application roles with accurate names like group names in RPD?

    I have to create groups in the weblogic console?

    Please help me in this regard.

    Hello

    Will have the opportunity to create new roles to application in the console (Application Strip) where you will find roles like BIConsumer, BIAuthor...

    Kind regards
    Srikanth

  • Helps with the update of Table

    Hi, I have a table created in book of recent years:

    idtable.png

    I would like to 'try' and just update with the new Word.docx

    word.png

    Is it EASY without complication or should I try and rebuild the table from scratch in Id?

    HOW THEN I update THE TABLE to ID card?

    Simply:

    (1) (copy the text of the .doc

    (2) select the text in the table Id, delete, paste

    This seems to have worked...

  • Can anyone help with a problem of table?

    Hello world!

    (ID CS5 - Windows 7)

    I have a lot of tables to prepare a very long document.

    The tables are in Word. I placed one of them and tried to make a table style. Everything works but I'm not able to save, in style, the height of the header of the table, or the height of the body lines, and the height of the footer. I think that it is possible to do so in the table styles. Am I wrong?

    I need lines, the header and the footer to have 6 mm, 5.5 mm and 14 mm

    I did a test with a table file and styles with a formatted table (and not formatted table) allows you to take a look and find out quickly what I am doing wrong. It's here: http://hotfile.com/dl/104806109/a1396b1/teste_2.indd.html

    Thanks in advance

    Maria

    You must set the cell styles for your lines of header and footer. Unfortunately there is no adjustment of height of the cells. You can force it by using a fixed first base Offset combined with top and bottom yokes. This will produce lines that are 1 p 3 high:

Maybe you are looking for