Updating a transparent table primary key

Hi Guys,
              I am fixing a system copy error, for that plan to update the table through a program.
The field I am going to update one of the primary key field.
Is that possible to do it.
Thanks

Hi,
  if you are going to insert a record it is possible.
if you are going to modify the existing record it is not possible to update the primary key you can only change the fields which are not primary key.

Similar Messages

  • TIPS(9):PARENT-CHILD(FOREIGN KEY) 관계를 갖는 MASTER TABLE의 PRIMARY KEY 확인.

    제품 : SQL*PLUS
    작성날짜 : 1996-10-21
    TIPS(9) : PARENT-CHILD관계를 갖는 TABLE의
    PRIMARY key, FOREIGN key의 COLUMN 명과 POSITION 확인
    ==============================================================
    ** Name : Show_Position.Sql
    ** Usage : @Show_Positions Parent_Table Child_Table
    ** Description : Shows Primary And Foreign Key Positions
    ** WARNING : 이 문장은 해당 Table의 Constraint생성시 Naming
    ** Convention을 따른 경우에 적용되도록 되어 있다.
    SET VERIFY OFF
    CLEAR BREAK
    BREAK ON CONSTRAINT_NAME ON TABLES
    SELECT SUBSTR(CONSTRAINT_NAME,1,27) CONSTRAINT_NAME,
    SUBSTR(TABLE_NAME,1,15) TABLES,
    SUBSTR(COLUMN_NAME,1,15) COL_NAME,
    SUBSTR(POSITION,1,3) POSITION,
    SUBSTR(OWNER,1,7) OWNER
    FROM USER_CONS_COLUMNS
    WHERE TABLE_NAME = UPPER('&1')
    AND CONSTRAINT_NAME LIKE 'PK%'
    UNION
    SELECT SUBSTR(CONSTRAINT_NAME,1,27) CONSTRAINT_NAME,
    SUBSTR(TABLE_NAME,1,15) TABLES,
    SUBSTR(COLUMN_NAME,1,25) COL_NAME,
    SUBSTR(POSITION,1,3) POSITION,
    SUBSTR(OWNER,1,7) OWNER
    FROM USER_CONS_COLUMNS
    WHERE TABLE_NAME = UPPER('&2')
    AND CONSTRAINT_NAME LIKE 'FK%'
    ORDER BY 1 DESC , 4 ASC;
    < 실행 예 >
    SQL> @SHOW_POSITIONS EMP_SERVICE EMP_SERVICE_LOG
    CONSTRAINT_NAME TABLES COL_NAME POS
    PK_EMP_SERVICE EMP_SERVICE EMP_ID 1
    CUST_ID 2
    FK_EMP_SERVICE_LOG_EC EMP_SERVICE_LOG EMP_ID 1
    CUST_ID 2

    제품 : SQL*PLUS
    작성날짜 : 1996-10-21
    TIPS(9) : PARENT-CHILD관계를 갖는 TABLE의
    PRIMARY key, FOREIGN key의 COLUMN 명과 POSITION 확인
    ==============================================================
    ** Name : Show_Position.Sql
    ** Usage : @Show_Positions Parent_Table Child_Table
    ** Description : Shows Primary And Foreign Key Positions
    ** WARNING : 이 문장은 해당 Table의 Constraint생성시 Naming
    ** Convention을 따른 경우에 적용되도록 되어 있다.
    SET VERIFY OFF
    CLEAR BREAK
    BREAK ON CONSTRAINT_NAME ON TABLES
    SELECT SUBSTR(CONSTRAINT_NAME,1,27) CONSTRAINT_NAME,
    SUBSTR(TABLE_NAME,1,15) TABLES,
    SUBSTR(COLUMN_NAME,1,15) COL_NAME,
    SUBSTR(POSITION,1,3) POSITION,
    SUBSTR(OWNER,1,7) OWNER
    FROM USER_CONS_COLUMNS
    WHERE TABLE_NAME = UPPER('&1')
    AND CONSTRAINT_NAME LIKE 'PK%'
    UNION
    SELECT SUBSTR(CONSTRAINT_NAME,1,27) CONSTRAINT_NAME,
    SUBSTR(TABLE_NAME,1,15) TABLES,
    SUBSTR(COLUMN_NAME,1,25) COL_NAME,
    SUBSTR(POSITION,1,3) POSITION,
    SUBSTR(OWNER,1,7) OWNER
    FROM USER_CONS_COLUMNS
    WHERE TABLE_NAME = UPPER('&2')
    AND CONSTRAINT_NAME LIKE 'FK%'
    ORDER BY 1 DESC , 4 ASC;
    < 실행 예 >
    SQL> @SHOW_POSITIONS EMP_SERVICE EMP_SERVICE_LOG
    CONSTRAINT_NAME TABLES COL_NAME POS
    PK_EMP_SERVICE EMP_SERVICE EMP_ID 1
    CUST_ID 2
    FK_EMP_SERVICE_LOG_EC EMP_SERVICE_LOG EMP_ID 1
    CUST_ID 2

  • Getting the UPDATEd value and its primary key

    I have two procedures, proc1 and proc2.
    In proc1 there is an update happening like
    CREATE OR REPLACE procedure proc1
    as
    TYPE NumList IS TABLE OF employees.employee_id%TYPE;
    enums NumList;
    TYPE NameList IS TABLE OF employees.last_name%TYPE;
    names NameList;
    BEGIN
    UPDATE emp set sal=900 WHERE department_id = 30
    RETURNING employee_id, last_name BULK COLLECT INTO enums, names;
    DBMS_OUTPUT.PUT_LINE('Updated ' || SQL%ROWCOUNT || ' rows:');
    FOR i IN enums.FIRST .. enums.LAST
    LOOP
    DBMS_OUTPUT.PUT_LINE('Employee #' || enums(i) || ': ' || names(i));
    END LOOP;
    END;
    /In proc2 which is getting executed just after proc2 i want to SELECT the sal column values and its primary keys(employee_id) which got updated in proc 1.
    How can i achieve this?

    add two out parameters from proc1 so that you can pass them into proc2 (obv. you'd need to add two in parameters to proc2 if they aren't there already)

  • 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

  • ON UPDATE CASCADE and Autoincrement primary key with Oracle SQL Developer

    hello everybody,
    I want to know if Oracle SQL Developer manage autoincrement on primary key and "ON UPDATE CASCADE" when i migrate (with data) SQL Server database in Oracle database.
    Can you help me ?
    Thanks for your suggestions.

    Obtain the value of the auto increment key with the getGeneratedKeys() method.
    Statement stmt = null;
    ResultSet rs = null;
    stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,
                                    java.sql.ResultSet.CONCUR_UPDATABLE);
    stmt.executeUpdate("DROP TABLE IF EXISTS autoIncTable");
        stmt.executeUpdate(
                "CREATE TABLE autoIncTable ("
                + "priKey INT NOT NULL AUTO_INCREMENT, "
                + "dataField VARCHAR(64), PRIMARY KEY (priKey))");
    stmt.executeUpdate(
                "INSERT INTO autoIncTable  (dataField) "
                + "values ('data field value')",
                Statement.RETURN_GENERATED_KEYS);
    int autoIncKeyFromApi = -1;
        rs = stmt.getGeneratedKeys();
        if (rs.next()) {
            autoIncKeyFromApi = rs.getInt(1);
        } else {
        rs.close();

  • Odi-target table-primary key

    hi,
    is it compulsory to have a primary key constraint in the target table in odi.
    Can we have a target table without any primary key constraint?

    Hi,
    Yes u can have target table without PK.
    Only for IKM Incremental Update u need to define Update key (which may not be persist in back end). For IKM Control append u no need to have PK defined.
    Thanks,
    Guru

  • Getting error message when passing data into table: Primary Key

    Getting an error in a process that is feeding the invoice creation in SAP, violation of PRIMARY KEY constraint 'INV1_Primary', cannot insert duplicate key in object 'INV1'. I assume this is due to duplicate key values being passed into the table INV1, however I get this error even when I am passing unique record combinations of the key fields docentry and linenum. This is on 2005A SP01.
    Thanks

    Hi Peter,
    Could you provide a code sample of the routine that is causing the error please?
    It sounds like a data corruption issue (though it could possibly be a bug in the DI API). I recommend you speak to SAP support. There is a utility that can validate the document numbering but you'll need to speak to SAP support before you run this as it can have other negative effects, depending on the state of your data. They may ask for a copy of your database to test.
    Kind Regards,
    Owen

  • Attachment Table - Primary Key in CO

    How can I add dynamically the primary key VALUE to an attachment table in CO processRequest??
    Thanks!
    Edited by: user12190100 on Apr 12, 2010 1:43 PM

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

  • Tables-Primary Key-Sequential read

    Hi Folks,
    Out of the following which imporves performace?
    1.Using all the primary keys of a table in the where clause of a select statement?
    2.Using any one or two (not all) primary keys of a table in the where clause of a select statement?
    Let me the know the same in the case of using an Secondary index.
    3.If we follow the second one,then it will go for a sequential read,how this sequential read mars the performance?
    4.How creating an index will affect the database as BASIS guys are not in favour to creating an index.
    Thanks,
    K.Kiran.

    1.Using all the primary keys of a table in the where clause of a select statement?
    2.Using any one or two (not all) primary keys of a table in the where clause of a select statement?
    Out of the above 2 first one will give more performance. Coming to primary key or Secondary indexses, anything.. it gives better performance if you give the key fileds in the order of DB declaration.
    I mean you are specifying some fields of primary key.. but not in the order .. i mean u have specified key1, key3, key4. It will give less performance than specifying only key1 and key2.
    in secondary indexes if you are not specifying all key completely that will take the key up to the order matches. i mean in key1, key3, key4 case.. it will consider only Key1.
    In Key1, Key2 case it will consider both.
    3.If we follow the second one,then it will go for a sequential read,how this sequential read mars the performance?
    4.How creating an index will affect the database as BASIS guys are not in favour to creating an index.
    Creating an secondary index will save the table contents in the format of starting with index fields in the DB. So number of indexes on the same table will need to craete more views in database. So leads to poor DB performance. i mean more space unnecesarily for a single table. That's why they will create indexes only for very frequently used fields on tables.

  • Trace a content update of transparent table

    Hi ALL,
    i need to know if it's possible to get the programme name,  responsible of a content update in a transparent table. we have a modification in exicting table record via a direct input (since the new valeus can't not pass the infty screens checks), and we need to know which programme was the update cause.
    Thanks in advance for your responses.

    check table DBTABLOG(Log Records of Table Changes) for any changes ...

  • OMPLUS retrieve table primary key column

    I'm trying to retrieve the primary key column associated with a table via OMBPLUS.
    The following command successfully returns the PK name
    OMB+> OMBRETRIEVE TABLE 'ODS_REGION' GET PRIMARY_KEY
    REGN_PKWhen I add the GET COLUMNS clause (as per API documentation), I'm still only getting the pk name.
    OMB+> OMBRETRIEVE TABLE 'ODS_REGION' GET PRIMARY_KEY GET COLUMNS
    REGN_PKAny suggestions on what I might be doing wrong?

    Worked it out. Syntaxt needed is:
    OMBRETRIEVE TABLE 'ODS_REGION' PRIMARY_KEY 'REGN_PK' GET COLUMNS
    (no GET between table name and PRIMARY_KEY clause)

  • Large table, primary key constraint

    I have migrated a table from 8i to 9i that is over 300 million rows. I migrated the the table to a 9i database without constraints or indexes.
    I have successfully created a composite index of two columns, t1 varchar2(512), t2 varchar2(32). This index took nearly 16 hours to create.
    I am now trying to create a primary key based on that index with the following sql:
    alter table table1
    add constraint table1_t1_t2_pk primary key(t1,t2)
    using index table1_t1_t2_idx
    nologging
    This process has taken over 24 hours and is well into the second day. Studio reports it will take an additional 15 hours to create.
    My questions are these?
    1. Is my syntax okay?
    2. I thought that by creating a primary key on an existing index, that another index is not being created. I thought it would be faster this way. Why is it taking a lot longer to create then the index it is based upon?
    3. Is there a more efficient method (other than parallel query) to create this index/constraint on such a large table? What happens when I go production and need to recreate this index if I have a failure. I have never had to do this before. I can't be down for 48 hours to create an index. What other alternatives do I have?
    The table is partit[i]Long postings are being truncated to ~1 kB at this time.

    Is INDEX table1_t1_t2_idx UNIQUE? If it's not that might explain why building the primary key constraint takes longer.
    I think the USING INDEX clause with an existing index is intended mainly for different UNIQUE constraints to share the same index. In your situation I think you would be better off just building the primary key constraint.
    Cheers, APC

  • Query not using remote table primary key.

    Hello all,
    My following query is not using the PK of remote database. vem_business_event_attribute is having a PK on ATTRIBUTE_TYPE_ID and business_event_id. The table is last analyzed on 04-dec-2010. It has around 5 milloin rows.
    select /*+ DRIVING_SITE(ve) */
    ve.ATTRIBUTE_TYPE_ID ,
    ve.BUSINESS_EVENT_ID ,
    ve.ATTRIBUTE_VALUE ,
    ve.ATTRIBUTE_AS_NUMBER
    from
    vem_business_event_attribute@hello ve,
    vem_attribute_types@hello va,
    delta_insert_businessevent de
    where
         ve.ATTRIBUTE_TYPE_ID = va.ATTRIBUTE_TYPE_ID
    ve.business_event_id = de.business_event_id
         and de.business_event_id < 90000000;
    Pls help.
    Regards

    If you need to move 150 million rows from one database to another, it is going to take some time, and a full scan would definitely be the most efficient sql way to do it. I would be surprised if 15 inserts of 10 million rows each would be faster than a single insert of 150 million rows.
    Depending on your exact requirements, it might be faster to use datapump to export the rows from the remote database and import them on the local database, but you will still be moving those 150 million rows across the network. You might get some advantage from the export/ftp/import option if you compress the dump file before the ftp, and uncompress it on the target, but that would depend on the additional time required to compress and uncompress.
    John

  • Automatic row processing updating my primary key

    Hi all!
    In Apex 3.2, I've got an Interactive report with a DML form on a table. My table has a primary key which use a sequence (trigger based). When I created my forms, I specified that I wanted to use an existing trigger as the source type of the primary key.
    When I try to create a record, it work. If I try to create a new record and save, my trigger give me an error message because the automatic row processing is trying to update the primary key too. (My trigger on the update specify that the primary key should not be updated).
    So my question is : How can I make the automatic row processing update everything but the primary key ? (I noticed that I could have asked APEX to use my SEQUENCE directly instead of the trigger (in the creation Wizard). But I dont know how to change this now that my form is created.)
    Is there a source type that I can change in my primary key item ?
    Note : My primary key item (id_emp) is protected and hidden. If I display it as "Display only", the update works... But I dont need to see id_emp on my form.

    OK,
    From your first post, it sounds as though the process is trying to perform an INSERT rather than an UPDATE. It is, therefore, trying to create a new record using a primary key that already exists on the table.
    If that is the case, then we need to go through the points along that route:
    1 - when you load a record into the page, the primary key page item should be given a value. So, firstly, check the link is populating the correct page item. And then, when the page has loaded, click the Session button on the Developer's toolbar at the bottom of the screen and check that the value is there
    2 - when the page loads, one, and only one, page item should have the primary key value. This should be P3_NO_EMPLOYE*. Check other page items to make sure that their source is not NO_EMPLOYE. Again, check with using the Session button to see if the value appears anywhere else on the page
    3 - when the page loads, the "SAVE" button should become visible. Check that this is conditional on P3_NO_EMPLOYE being NOT NULL
    4 - there should be one, and only one, button that triggers the SAVE action. Check that there are no other buttons that either (A) are called SAVE or (B) trigger the INSERT SQL database action
    5 - when the SAVE button is clicked, the "Process Row of..." process should be triggered and, because the button is SAVE and, therefore, sends "SAVE" as the REQUEST value, the process identifies this request as an Update database action. Check that you have Update ticked on the process and that you only have one process that can perform the update
    6 - it is possible to change the value of the Request after a button has been clicked, so check that you have no computations or processes that run before the "Process Row of..." process
    Andy

  • Who can I update primary key field in master block

    Hi,
    I want to update the primary key field in master block when there are some records are present in detail block, when I edit the primary key filed there is an error FRM-40509 unable to update record. The primary key is also referred by the detail table.
    So kindly give me the solution who can I update the primary key in master block when there is child records exists in detail block?.
    Best regard,
    shahzad

    pls tell us a little more about, why you want to update a PK in a master block.
    I haven't done that my whole time. Maybe you need something different.
    The problem is, that your child-data references to the master-pk, so there is the point you have to go deep into the codings. But better don't do it. Tell us first why. I think there are other solutions for that.
    try it
    Gerd

Maybe you are looking for

  • How to change mouse pointer to Arrow?

    When we move the mouse over any component in preview (or in SWF file), mouse pointer changes to u201Chandu201D. Is it possible to keep the mouse pointer to Arrow or any other custom mouse pointer in Xcelsius 2008 SP 4? Thanks

  • Question about Intel 82801FBM LPC Interface Controller in a Tecra A3X

    I have had to replace the HDD in a A3X. XP pro sp2 loaded fine and all's well but the device mngr is reporting this Intel 82801FBM LPC Interface Controller as an Unknown Device. The Intel Chipset ID Utility identifies this as a component of the Chips

  • PLEASE HELP - ITOUCH WONT LOAD VIDEOS OR MUSIC OR PODCASTS!!!!

    i have a 16g itouch 1st gen and it will not load my videos, music, or podcasts. each time i select music/video from home screen, i get a white screen for 15-25 seconds and then returns to home screen. internet works fine i tried soft reset and hard r

  • Sorting invoices to be printed

    Hello everybody, Is there any relation between an output message (NAST) and the generated spool order (TSP01)?  I have a list that shows all the spool orders and I need to know the SD document associated. Is it possible? I have to create a program to

  • F.81 Reverse Accural/ Deferred entries

    While reversing entries through f.81, i want to restrict one business area in which i dont want any entry to be reversed. In other words, there is a business area which is going to take a shape of a new company code itself, so i just want to restrict