Updatable report strange "Primary Key Source" behaviour

I have an updatable report based on a table with one primary key
When I create the report and try to edit the last field to give it a default value, I get
"Primary Key Source" while I should get the default option.
The field in question isn't a primary or foreign key and can be NULL.
Does anyone know why this is?

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

Similar Messages

  • Primary Key Source returning improper value

    Hi All,
    I have a tabular updateable form.
    My Primary Key field has
    Primary key Source Type : Custom PL/SQL Function
    Primary key Source : RETURN (EB_PACKAGE.GET_COD_NUM (:P4_CTY_TYPE));
    My function is in a package and is executing properly and i have checked it.
    I have an Item on that page as P4_CTY_TYPE whose value i'm passing to obtain the Primary key.
    But my problem is the function does not return a proper value, i feel the value being passed for the function is always same. Why is proper value not being passed.
    Hopefully I have explained my problem, if not let me know so.
    Hoping for the solution.
    Thanks n Regards
    Arif

    Hi Ravi,
    Thanks for the reply and sorry for late reply.
    The session value for P4_CTY_TYPE is ok.
    P4_CTY_TYPE is a Select List with Submit.
    I have a Report and there's a link which changes the value of P4_CTY_TYPE or can be changed by itself as it is a Select List.
    Depending upon the value of P4_CTY_TYPE I'm displaying records in a Tabular form with Insert, Update and Delete facilities.
    Now Suppose the Value for P4_CTY_TYPE is 10 at the start of the session then the function works fine and it always does for this value, when i select other value for P4_CTY_TYPE say 20. The value returned by my function is as if the parameter value being passed to the function EB_PACKAGE.GET_COD_NUM (:P4_CTY_TYPE)) is 10 and not 20. This is what i mean by function does not return a proper value.
    If any more clarification required do let me know.
    Thanks Once again.
    Arif

  • Need to manually update an automatic primary key sequence

    EDIT:  I think this is actually a privileges issue not letting me see the sequences.  Sorry for the trouble
    Hi everyone. I actually didn't know this was possible until I came across this table. This table has a primary key that autoupdates without a trigger or a sequence. so...
    id name
    1 jim
    2 mark
    insert into t1 (name) values ('bob') :
    id name
    1 jim
    2 mark
    3 bob
    My problem is that I manually inserted some rows into this table with the id's as part of the insert statement and now the old way doesn't work. I am assuming because wherever this sequence is it still thinks 3 is the next value. Does anyone know how i can update this value so that the bob-style insert will work again? There are no triggers or sequences in this database (according to what I'm looking at in SQL Navigator. Thanks!
    Edited by: samspot on Feb 4, 2009 12:08 PM

    Can you please run following query and send us the output?
    select *
    from all_triggers
    where table_name = 'T1' ;Edited by: arpit_shah4u on Feb 4, 2009 3:07 PM

  • How to update a parent (primary key) value?

    hello...can anybody give me a hint that how to update a primary key value in master table through forms as well as update all child records keeping in mind that "ALTER TABLE" and constraint disabling is not permitted by DBA. Parent Records are being displayed in form in a database block while child records are not displayed on form.

    See
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:914629004506
    and
    http://tkyte.blogspot.com/2009/10/httpasktomoraclecomtkyteupdatecascade.html
    cheers

  • How to update data when primary key is set through for update cursor

    Dear friends,
    I have tried to update data in the table through forms using cursor for update and i have given the plsql i have used please help me where i do mistake.
    DECLARE CURSOR EMP IS
    SELECT EMPNO,EMPNAME,FATHERNAME,COMMUNITY,SEX,BILLUNIT,BIRTHDATE,RLYJOINDATE,RETIREMENTDATE
    FROM PRMAEMP WHERE BILLUNIT=:CTRL.BILLUNIT AND SERVICESTATUS='SR'ORDER BY DESIGCODE,SCALECODE
    FOR UPDATE;
    BEGIN
    GO_BLOCK('EMP_DETAILS');
    SYNCHRONIZE;
    FOR I IN EMP
    LOOP
    I.BILLUNIT:=:EMP_DETAILS.BILLUNIT;     
    I.EMPNO:=:EMPNO;
    I.EMPNAME:=:EMPNAME;
    I.FATHERNAME:=:FATHERNAME;
    I.COMMUNITY:=:COMMUNITY;
    I.SEX:=:SEX;
    I.BIRTHDATE:=:BIRTHDATE;
    I.RLYJOINDATE:=:RLYJOINDATE;
    I.RETIREMENTDATE:=:RETIREMENTDATE;
    DOWN;
    END LOOP;
    COMMIT;
    END;
    your help is needed immediately

    DECLARE CURSOR ABC IS
       SELECT EMPNO,
              EMPNAME,
              FATHERNAME,
              COMMUNITY,
              SEX,
              BILLUNIT,
              BIRTHDATE,
              RLYJOINDATE,
              RETIREMENTDATE
    FROM PRMAEMP
    WHERE BILLUNIT=:CTRL.BILLUNIT
    AND SERVICESTATUS='SR'
    ORDER BY DESIGCODE,SCALECODE
    FOR UPDATE OF COMMUNITY;
    V_EMPNO           PRMAEMP.EMPNO%TYPE;
    V_EMPNAME         PRMAEMP.EMPNAME%TYPE;
    V_FATHERNAME      PRMAEMP.FATHERNAME%TYPE;
    V_COMMUNITY       PRMAEMP.COMMUNITY%TYPE;
    V_SEX             PRMAEMP.SEX%TYPE;
    V_BILLUNIT        PRMAEMP.BILLUNIT%TYPE;
    V_BIRTHDATE       PRMAEMP.BIRTHDATE%TYPE;
    V_RLYJOINDATE     PRMAEMP.RLYJOINDATE%TYPE;
    V_RETIREMENTDATE  PRMAEMP.RETIREMENTDATE%TYPE;
    BEGIN
       GO_BLOCK('EMP');
       SYNCHRONIZE;
       OPEN ABC;
       LOOP
          FETCH ABC INTO .... /*yOU NEED TO MENTION YOUR VARIABLES HERE*/;
          UPDATE PRMAEMP
          SET BILLUNIT= :EMP.BILLUNIT,
              EMPNO= :EMPNO,
              EMPNAME= :EMPNAME,
              FATHERNAME= :FATHERNAME,
              COMMUNITY= :COMMUNITY,
              SEX= :SEX,
              BIRTHDATE= :BIRTHDATE,
              RLYJOINDATE= :RLYJOINDATE,
              RETIREMENTDATE= :RETIREMENTDATE
          WHERE CURRENT OF ABC;
          EXIT WHEN ABC%NOTFOUND;
       END LOOP;
       CLOSE ABC;
    END;
    COMMIT;
    END;Cheers
    Sarma.

  • 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

  • Update a primary key and Fk

    Hello
    I have to update a primary key (PK) which is referenced by many foreign keys (FK).
    The primary key columns cannot be updated as this would orphan the dependant tables,
    and the dependant tables cannot be updated prior to the parent table as this would also make them orphans.
    I think this problem was solved by disabling the foreign key constraints or deleting the original records and recreating them.
    Since neither of these solutions is particularly satisfactory for me I read about 'deferred constraints'.
    My question is:
    Can I use(modify to) 'INITIALLY DEFERRED' keyword on constraints's table already created with The default, INITIALLY IMMEDIATE ,
    that is, update my primary key and foreign keys, and then re-set to
    'INITIALLY IMMEDIATE'? Or another trick exists ?
    Thanks in advance for your attention

    It is very popular the idea that the updates on primary key columns are a very bad thing.
    Oracle supports this idea and that's why they don't give the "on update cascade" clause on foreign keys.
    So in this case I suggest you to define a master table like this.
    create table master_table (
         key_id number primary key,
         your_primary_key varchar2 not null unique
    /Then you must use that key_id column as foreign key in place of your original primary key. In this way don't even need to update referencing rows when updating the original primary key because the foreign key value doesn't change and everything is always fine as before.
    So instead to lose time implementing some strange sort of cascade triggers plain to do something like this on your schema.
    insert into master_table (id_key,primary_key) (
         select rownum,primary_key
         from your_main_table
    alter table your_main_table add (
         id_key number,
    update your_main_table a
    set id_key = (
              select b.id_key
              from master_table
              where b.primary_key=a.primary_key
         Drops foreign keys
    alter table your_main_table drop primary key cascade
    alter table your_main_table add constraint pk
         primary key(id_key)
    alter table your_main_table add constraint fk
         foreign key(id_key) references master_table
    alter table your_main_table drop (
         your_primary_key
    alter table a_referencing_table add (
         id_key number,
    update a_referencing_table a
    set id_key = (
              select b.id_key
              from master_table
              where b.primary_key=a.primary_key
    alter table a_referencing_table add constraint fk_2
         foreign key(id_key) references master_table
    alter table a_referencing_table drop (
         your_primary_key
    /If you have many objects referencing those tables I suggest you to rename the tables and to create views with the original name of the renamed tables that show data as it was before with a join on master_table. in this way you don't need to change the code of the application referencing them but you just need to recompile invalidated objects.
    Bye Alessandro

  • How I get the primary key in a interactive report?

    hi,I'm a noob of apex.
    I want to get a Interactive report's primary key or rownum,and I try to use the f01...but it doesn't work.
    how can I do this.
    zl

    Have a look at: Re: To reference Interactive Report filtered rows in PL/SQL

  • Using a custom PL/SQL to populate the primary key in a tabular form

    I want to use a Custom PL/SQL Function to populate the primary key when I insert a new record into a tabular form. I want to get the value from a hidden page Item. The code I am using for the primary key source is:
    BEGIN
    INSERT INTO TEAM_MEMBERS(TEAM_ID)
    VALUES(:P75_TEAM_ID);
    END;
    When I try to insert a new record I get the following error:
    Error      ERR-1904 Unable to compute item default: type = Function Body computation_type= BEGIN INSERT INTO TEAM_MEMBERS(TEAM_ID) VALUES(:P75_TEAM_ID); END; .
    ORA-06550: line 5, column 2: PLS-00103: Encountered the symbol ";" when expecting one of the following: begin case declare end exception exit for goto if loop mod null pragma raise return select update while with << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe The symbol "exit" was substit
    Any ideas what I am doing wrong?
    Thanks!

    Brian - Sometimes whitespace at the end of the block causes this. Be sure to trim everything after the last semicolon including tabs and newlines.
    Scott

  • How to make a form using a wizard when the table has no primary key ?

    Hi,
    I want to make a form to update, delete a table. The table has no primary key. The problem is that the Wizard ask for a primary key.
    How to avoid using a primary key ? i mean I don't want to create a primary key if is is possible.
    I would like to use the wizard; is it possible ?
    Thank you for your kind answers.
    Christian

    I believe the key is choosing 'Interactive' as opposed to 'Classic' in the implementation and then you can choose 'Existing Trigger' for the primary key source and it should work to use an existing column as your proimary key.

  • Primary key column in manual tabular form

    I am creating a manual tabular form and am unsure what to do for my primary key column. When I do this with the wizard, I'm allowed to specifiy a Primary Key Source Type and the Primary Key Source (my sequence). Is there a way to do this in a manual tabular form?
    I'm creating the column with the call 'wwv_flow_item.display_and_save(2,hours_id) hours_id' but when I edit the 'Tabular Form Element' section, I don't have the Primary Key fields anywhere to edit...only Reference Table Owner, Reference Table/Column Name. Where can I specify the sequence?
    Thanks,
    Janel

    In the process ApplyMRD, try specifying the 'Secondary Key Column' in the section 'Source: Multi Row Update and Delete' to the second key column in the tabular form.
    I haven't tested this with your situation, but worth a shot.

  • Read-Only Primary Key

    Hi All,
    I am trying to figure out a way to keep my primary keys from being edited. I created a primary key constraint but did not know how to set it as read-only.
    Each time I create a new record, commit, and change its primary key, Oracle allows me.
    Can someone please shed a light to this?
    THanks!

    I was actually thinking of that update trigger but I thought maybe there was a direct declaration or attribute that I could simply set to my primary key constraint as read-only. No there is nothing like that as far as i know.
    In regards to allowing update on primary key, that is my issue I don't know how to set it to read-only. I don't allow it. It's default. If I go to my table and start typing on the primary field, it'll replace it without throwing an exception. Its not a rule of thumb that the primary key should not be updated. And hence such a thing is not set by oracle. But as far as best practice is concern its good not to update a primary key.
    I just thought maybe there was a direct solution. I guess I have to just apply another step to my process. Thanks! The best way is to Design your application in such a way that it does not allow any updation on the primary key.

  • Problem with update of BLOB field in a table with compound primary key

    Hi,
    I've been developing an application in Application Express 3.1.2.00.02 that includes processing of BLOB data in one of the tables (ZPRAVA). Unfortunately, I've come across a strange behaviour when I tried to update value in a BLOB field for an existing record via a DML form process. Insert of a new record including the BLOB value is OK (the binary file uploads upon submiting the form without any problems). I haven't changed the DML process in any way. The form update process used to work perfectly before I'd included the BLOB field. Since than, I keep on getting this error when trying to update the BLOB field:
    ORA-20505: Error in DML: p_rowid=3, p_alt_rowid=ID, p_rowid2=CZ000001, p_alt_rowid2=PR_ID. ORA-01008: not all variables bound
    Unable to process row of table ZPRAVA.
    OK
    Some time ago, I've already created another application where I used similar form that operated on a BLOB field without problems. The only, but maybe very important, difference between both the cases is that the first sucessfull one is based on a table with a standard one-column primary key whereas the second (problematic one) uses a table with compound (composite) two-column PK (two varchar2 fields: ID, PR_ID).
    In both cases, I've followed this tutorial: [http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm]).
    Can anybody confirm my suspicion that Automatic Row Processing (DML) can be used for updating BLOB fields within tables with only single-column primary keys?
    Thanks in advance.
    Zdenek

    Is there a chance that the bug will be included in the next patch?No, this fix will be in the next full version, 3.2.
    Scott

  • 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

  • Tabular Form Page - Insert and Update Primary Key

    Hi -
    I am creating a Tabular Form page which will display 2 columns:
    CODE (Text Field), DESCRIPTION(Field)
    The *'CODE'* is a primary key to the table/view and *'DESCRIPTION'* is the corresponding detail information for the *'CODE'*.
    I am trying to create an updateable report on this page which will show these columns and when a user wants to add a new row,they should be able to add a new row with CODE='somecode' and DESCRIPTION='description' but shouldn't be able to update (but should be displayed) the *'CODE'* value once inserted into the table or view.
    Is there a way to do that? Please share your expertise.
    Thanks,
    -Seenu

    I't a bit unclear what you want.
    In your first post it seems that you don't want the user to change the PK.
    In your second post the user can change the PK, but you get a db error.
    Anyway, I guess you don't want the user to change the PK.
    I have a few support tables, which are the source for some LOV's.
    For those I also add records with a manual assigned PK, rather then via a sequence, just to improve consistency across applications.
    The data is protected by foreign keys to the main tables.
    You could further add a trigger to your table which throws an error the moment it detects a change on your PK.

Maybe you are looking for