Automated row fetch / Complex primary key

I have a complex primary key made up of ticket_num, ticket_seq because there may be between 1-3 rows associated with one ticket_num.
The problem I am having is the automated row fetch errors out when trying to update a ticket with the following error even though the combination of ticket_num, and ticket_seq are unique, and ticket_num, ticket_seq are entered in the automated row fetch as primary key column, and secondary key column.
ORA-01422: exact fetch returns more than requested number of rows
Is there a way to put both columns as the primary key?

Thanks, Scott. I had the exact same problem, and your suggestion fixed it.
May I suggest that this is a bug in Apex? In the create application wizard, select "Add Page" -> "Report and Form", and select a table with a compound primary key consisting of two columns. Apex will create the report and the form, and will configure the ARF correctly in the form, but it does not specify a value for the second key in the Link Column section of the report attributes.
Thanks,
Mike

Similar Messages

  • Automated Row Fetch for complex primary keys

    I would like to post a workaround for using automated row fetch on tables with a complex primary key (more than 2 components).
    APEX has the restriction of just beeing able to handle <= 2 PK components, which is not acceptable to me in quite a lot of scenarios.
    Imagine a situation where you want to manage recipes for dishes. Each recipe has several versions and each version has several recipe-positions. The PK consists of recipe_id, recipe_version and recipe_position.
    You hava a report displaying the positions of a specific recipe version and this report contains an edit link that jumps to a form, where the attributes of a recipe position can be edited.
    Creating the edit position form, you can only specify a primary and a secondary key item/column. Given that, if you want to use the edit form by clicking the edit link, you will receive the error "ORA-01422: exact fetch returns more than requested number of rows", because the third PK compound is not used as a restriction.
    The workaround is to present the ROWID pseudo-column to the form as the primary key.
    Create a (hidden) Item to store the ROWID-Value of the current row and simply change the properties of the ARF-Process to accept ROWID as the PK column and specify the corresponding item.
    If automated processing of recipe_position is desired, you can specify it as the secondary key column.
    I don't know if this woraround/solution is very ugly, but it works ...
    Ingo

    Hello Ingo,
    I tend to avoid ROWID. In the Interactive Report it's used too.
    The ROWID can change, where a Primary Key normally doesn't change, that's the biggest thing I worry about. How does Oracle know not somebody else already updated the row?
    I always wonder what happens when you're in a cluster/RAC and use ROWID. Isn't it possible that you get two rows for the same rowid?
    Just my thoughts.
    Regards,
    Dimitri
    -- http://dgielis.blogspot.com/
    -- http://apex-evangelists.com/
    -- http://apexblogs.info/

  • Table and Primary Key Case Sensitive in Automated Row Fetch

    Why are the table and primary key fields case sensitive in the Automated Row Fetch process? I'm debugging an error in this process and I'm not sure what the case should be.

    Russ - It's a defect of sorts. Use upper case in the process definition. I don't think these processes will work with tables or columns whose names are not known to the database as upper-case values, i.e., defined using double-quoted non-upper case.
    Scott

  • How to trigger the automated row fetch process and open modal window by javascript api?

    Hi,
    I would like to click the one row of column of IR report, to open the modal window of current page.  <----------------it is ok. I can use "javascript:openModal('windowID')"  to do it.
    There is one form in this modal window, Meanwhile, I would like to pass column data to this form.    <--------------------- it is ok also. I can use " $s('P7_ID','column_value');" to do it.
    But I don't know how to trigger the "automated row fetch" process of this form to retrieve other field's value in this form.   
    I tried to use following 2 ways. But failed.
    First method:
    add one ajax process of "automated row fetch" in "page processing" block, named "get_fetch_data"
    when click IR column , call "openModal", and call  "apex.server.process ( "get_fetch_data", {}, { success: function( pData ) { }  } );"  , I tried to call above ajax process to refresh form. It is failed.
    Second method:
    add one process of  "automated row fetch" in "page rendering" block, named "get_fetch_data"
    when click IR column, call javascript api "apex.submit" to submit current page , then call "openModal".
    such as :  javascript:apex.submit({request:'MODIFY',set:{'P7_ID': #ID#}}); openModal('trade');
    But it is failed also. the modal page is showed firstly. then page refresh. but modal window will not open again.
    I am not sure if my thinking is right. Could you please provide any suggestion?
    Thanks in advance,
    Ping

    Hi Ping,
    You can try to set the session state of your modal page's primary key before opening the modal page. Use one dynamic action (on click of IR row) with two true actions. First one to set session state of modal page pk, second on to open modal page.
    Or you can add the modal page url as link in your report by extending your query:
    select ...
    ,         apex_util.prepare_url( 'f?p='||:APP_ID||':7:'||:APP_SESSION||'::'||:DEBUG||':7:P7_ID'||COLUMN_VALUE ) as link
    from ...
    This will give you the url of the modal page, with set primary key.
    Regards,
    Vincent Deelen
    http://vincentdeelen.blogspot.com

  • Automated Row Fetch

    I am struggling to get two forms on the same page work as they are suppose to. One of the problems is with Automated Row Fetch. To condense the problem I tried the following (on a test page):
    Created a form/table on table A with primary key PK_A
    Among other things this creates the automated row fetch for this form and a field P1_PK_A. containing the PK.
    Created another form/table on table B with primary key PK_B which creates automated row fetch for B and P1_PK_B
    Since I am concentrating on fetch process deleted all buttons and processes except FETCH row for both forms.
    Now:
    When I pass a value to P1_PK_A in the URL and no value for P1_PK_B it fetches the row in form A fine, same is true the other way around. However if I pass valid keys for both forms in the URL it fails to fetch row for the second form.
    Am I missing something or if not how am I to have two forms on a page?

    Thanks for the quick response Joe,
    I deleted the process created by the wizard and created another data manipulation process with the wizard - which created another autmated row fetch and makes no difference. By creating the fetch and DML manually do you mean that I have to create PL/SQL process to fetch the values for the second form?
    Btw how in the world I missed the part that you can't have two automated DML processes on a page I don't know.

  • Automated row fetch returns more than one row

    Greetings All,
    Does anyone know of a way to call a page if the automated row fetch returns more than one row. I have a form with a primary and secondary key. If I search only on the primary key and there is more than one row I would like to call a popup with the multiple list, is this possible?
    Regards
    Mark

    Create a view on a table you want to update if you have more than two key values.
    However, the automated row fetch does support two key values.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Two 'Automated Row Fetch'-processes at one page

    All,
    I have a page with several fields (P24_xxx_Reg1 & P24_xxx_Reg2) in two regions.
    For every region I have an ‘Automated Row Fetch’-process, because they base on different tables.
    The second process sets the field values of region 1 to null,
    even all is different: fieldnames, sources, regions, processes, etc.
    Any help appreciated,
    thanks in advance
    lucio

    Create a view on a table you want to update if you have more than two key values.
    However, the automated row fetch does support two key values.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Set memory cache - automated row fetch

    I would like to know more about the difference between
    Set Memory Cache On Display and
    Set Memory Cache On Fetch
    option, given in the Automated Row Fetch process.
    I noticed that it makes a difference in some cases - especially where I have a master-detail relation and need to perform multiple drill down:
    e.g. the report shows what was expected but export to .csv returns no rows. After switching from the default 'Set Memory Cache On Fetch' to 'Set Memory Cache On Display' everything works fine.
    Where could I find something about this option?
    Denes Kubicek

    Denes - I'd need to see an example to explain it. It is not the behavior I would expect. Can you create a simple test case on htmldb.oracle.com? Please post the workspace name and app/page ID when you have it.
    A bit more info: when the DML Fetch Mode is set to 'Set Memory Cache On Display', references to items sourced by the fetch, say &P1_ENAME., will not return the value that would be displayed in the form item P1_ENAME until after the code that emits P1_ENAME executes. So if your page had a before-header DML Fetch process that fetched a value for P1_ENAME (from EMP) and region A that displayed conditionally based on P1_ENAME = 'SMITH' and then region B containing the form item P1_ENAME and then region C that displayed conditionally based on P1_ENAME = 'JONES', the condition on region A would not see the fetched value of P1_ENAME but the condition on region C would see the value. However, if you set 'DML Fetch Mode to 'Set Memory Cache On Fetch', the condition in region A would see the fetched value.
    When you have a csv link or chart region that references a value from session state, that value must have been committed to session state (which happens when you run a computation, do an explicit assignment or "select into" a bind variable associated with a page or application item, or when you submit a form) in order for the csv or chart page to access the current value.
    Scott

  • Automated Row Fetch binding

    Hi Experts,
    Apex 4.1
    This is what i'm trying to do.
    I have number of fields in a form.
    Value for the Fields are fetched from two different tables using Automated Row Fetch.
    When the page loads only one ARF process would run based on a flag value in the application item and only those fields specific to that ARF should be populated.
    what i have noticed is when one ARF executed apex tries to bind all the fields on the form which have source type as Db column.
    in my case when it tries to bind a field which is basically populated by second ARF. it throws error message.
    What i what t know is,
    When we have multiple ARF on a page, is there any way to specifiy.. these fields are only populated by this ARF ?
    Really appreciate if someone can assisit me on this.
    Thanks
    T.kurubaran
    Edited by: Apex-Ape on Mar 29, 2012 1:12 AM
    Edited by: Apex-Ape on Mar 29, 2012 1:13 AM

    Apex-Ape wrote:
    what i have noticed is when one ARF executed apex tries to bind all the fields on the form which have source type as Db column. This is the expected behaviour of ARF processes.
    When we have multiple ARF on a page, is there any way to specifiy.. these fields are only populated by this ARF ?No.
    You should create custom row-fetch process to achieve this.

  • Automated Row Fetch  Issue

    Hello
    I have a form based on a table where i have 2 keys as primary key (col1,col2)==>composite pk.
    sample values are like:
    col1 col2
    1 21
    2 21
    62 21
    62 1
    But issue is at the point where the automatic row fetching is getting executed
    [Automated Row Processing section on edit page]
    Primary column value is col1(only one column is allowed in apex Auto row fetch)
    Secondary key column is col2.
    For ex, when i access the row for col1=62, it fetches 2 rows where value=62 (based on col1)
    and i get error;
    (exact fetch returns more than 1 row)
    How to avoid this
    thanks
    kp

    Setting the proper page item in the Item Containing Secondary Key Column Value field and proper table column name in the Secondary Key Column of the row fetch screen should work. My off-the-cuff guess would be that either one of those fields does not have the correct value, or when you are branching to this page that the page item containing the secondary key is not being populated.

  • What is the diffrence between Row id and primary key ?

    dear all
    my question is about creating materialized views parameters (With Rowid and
    With Primary kry)
    my master table contains a primary key
    and i created my materialized view as follow:
    CREATE MATERIALIZED VIEW LV_BULLETIN_MV
    TABLESPACE USERS
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    REFRESH FAST ON DEMAND
    WITH PRIMARY KEY
    AS
    SELECT
    BCODE ID, BTYPE BTYPE_ID,
    BDATE THE_DATE,SYMBOL_CODE STOCK_CODE,
    BHEAD DESC_E, BHEADARB DESC_A,
    BMSG TEXT_E, BMSGARB TEXT_A,
    BURL URL, BTIME THE_TIME
    FROM BULLETIN@egid_sefit;
    I need to know is there a diffrence between using (with row id) and (with primary key) on the performance of the query?

    Hi again,
    fast refreshing complex views based on rowids, according to the previous subject.
    (You're example shows that) are not possible.
    Complex remote (replication) snapshots cannot be based on Rowid too.
    for 10.1
    http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_6002.htm#sthref5054
    for 10.2
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_6002.htm#sthref6873
    So I guess (didn't check it) that this applies ONLY to replication snapshots.
    This is not documented clearly though (documentation bug ?!)
    Documentation states that the following is generally not possible with Rowid MVIEWS:
    Distinct or aggregate functions
    GROUP BY or CONNECT BY clauses
    Subqueries
    Joins
    Set operations
    Rowid materialized views are not eligible for fast refresh after a master table reorganization until a complete refresh has been performed.
    The main purpose of my statements was to try to give a few tips how to avoid common problems with this complex subject, like for example: being able to CREATE an MVIEW with fast refresh clause does not really guarantee that it will refresh fast in the long run (reorganisation, partition changes) if ROWID based, further the rowid mviews have limitations according to the documentation (no group by, no connect by, link see above) plus fast refresh means only to use filter columnns of the mview logs, plus for aggregates you need additional count (*) pseudo columns.
    kind regards
    Karsten

  • Determining the row id or primary key columns and values genericaly

    Hi There
    Does anyone perhaps know how to determine the rowid of the
    currently selected row in a form, or alternatively the primary
    key values/columns?
    Regards
    Herman

    Hi Tranen,
    you can view the constraints and respective columns by setting the
    Table Shape Properties in the Property Inspector.
    Select (all) the tables on the Diagram you want
    In the Property Inspector,under Constraints -Set the 'Show Constraint Columns' to 'True',
    Set 'Show Constraints' to 'True' .
    Constraints (PK,UK,FK,Check)
    Also Set the 'Show Columns' option to 'False' .This will be under display options in the Property inspector.
    This should modify the Table shape in the diagram as follows:
    <Table name>
    <PK> PKName:Column1,Column2
    <UK>UKName:Column3
    <FK>FKname:Column1
    are you looking for the same?
    Thanks.

  • Form Validation on Complex Primary Key

    I have a that inserts/updates a table with a 2 coulmn primary key (ticket_num, ticket_seq). Is there anyway to create a page validation item that will keep users from violating the pk constraint and getting the ugly ORA-00001 error.
    I think I just don't understand the syntax of the "SQL Expression" validation.
    I would like to just find if the key already exists, but the following does not seem to catch it. I have put the following in validation expression 1.
    (select count(*)
    from system_issue_timings
    where ticket_num = :P3_TICKET_NUM
    and ticket_seq = :P3_TICKET_SEQ) > 0

    The pl/sql with count(*) above will not work as select count(*) into... will never raise no_data_found, it will result in zero in v_test.
    The other thing to watch out for on this type of validation (whether implemented as sql not exists or as a pl/sql returning boolean or pl/sql returning error) is that if you are doing updates on this page then you need to either :
    1. not fire the validation when updating (assuming you cannot modify the primary key columns on the page), or
    2. specifically exclude the row being updated from the validation lookup (using rowid for example) as otherwise it will satisfy the condition and fail the validation.
    You want to probably use 'sql NOTexists' validation as it "Passes if the query return no rows." :
    select 1
    from system_issue_timings
    where ticket_num = :P3_TICKET_NUM
    and ticket_seq = :P3_TICKET_SEQ
    Glen
    Edited by: gjmorris on Sep 24, 2008 1:02 PM - added actual solution.

  • Insert values in multiple tables. One of the tables has complex primary key.

    Hello, I am using Jdeveloper version 11.1.2.3.0
    I have a table FORM_TYPE and another table Str. The Str table is used to translate strings from the table name which are read from another program from the database and used to generate forms..
    The FORM_TYPE  table has a relation to the STR table via formtype.title_str_id = str.str_id.
    The STR table has a primary key that is depending on mf_language and str_id columns. I generated entity for the STR table but can't insert from the application module new values for some reason... It says the record invalidates its own entity..
    I am trying to create a table that will be editable and will have the columns Description, Name, Str in English, Str in French etc...
    Want to create a Form_Type and in the same time to insert new values for each language... But can't make the inserts of the new STR work..
    Also the    FormType.TITLE_STR_ID has many values null already in the database.
    SELECT FormType.DESCRIPTION,
           FormType.FORM_TYPE_ID,       
           FormType.NAME,
           FormType.PAPER_REPORT_FORMAT,
           FormType.PAPER_REPORT_NAME,
           FormType.TITLE_STR_ID,
           en.str en_str,
           en.str_id,
           en.object_name en_object_name,
           fr.str,
           fr.str_id,
           fr.object_name,
           du.str,
           du.str_id,
           du.object_name,
           bg.str,
           bg.str_id,
           bg.object_name      
    FROM FORM_TYPE FormType,
    (select str.str_id, str.mf_language_id, str.str, str.object_name
    from mf_language ml,  str
    where ml.mf_language_id = str.mf_language_id
    and ml.code ='en') en
      , (select str.str_id, str.str, str.object_name
    from mf_language ml,  str
    where ml.mf_language_id = str.mf_language_id
    and ml.code ='fr') fr,
      (select  str.str_id,   str.str, str.object_name
    from mf_language ml,  str
    where ml.mf_language_id = str.mf_language_id
    and ml.code ='du') du,
      (select  str.str_id,  str.str, str.object_name
    from mf_language ml,  str
    where ml.mf_language_id = str.mf_language_id
    and ml.code ='bg') bg
    WHERE
    formtype.title_str_id = en.str_id and
    formtype.title_str_id = fr.str_id and
    formtype.title_str_id = du.str_id and
    formtype.title_str_id = bg.str_id  

    Tried that I made view links and associations but still can't insert in both tables at once... Could be because the tables aren't having relationship between them or because the STR table has a (STR_ID, MF_LANGUAGE_ID) primary key...

  • Automated row fetches, checkboxes and null values

    Hi
    In Apex3 I have a page with automated fetch row process that is working fine. Now I need to add a new not null varchar2 column "flag" which can be a Y or a N.
    To do so, I created a new checkbox item p1_flag, set the source properties and the LOV definition to: STATIC2:Flag set;Y
    However when I try to save the data with the checkbox unticked I get a null value error. To solve it, I created a computation on that field like this:
    nvl(:p1_flag, 'N')
    Is this the best way to do it? (other than using database triggers)
    Thanks
    Luis

    Hi Patrick
    Thanks for the reply. I thought that, just wondered if there were a better way...
    Another option that I was thinking about was to modify the column definition to be nullable, with valid values being Y and null. So I wouldn't have to care about it. The only thing being that I don't like very much the idea of modifying the database design because of the development tool (though I saw things much worse than this, as using VARCHAR2 instead of DATE because the front end tool didn't handle date datatypes very well!)
    Or just stick to a trigger to do it.
    Cheers
    Luis

Maybe you are looking for

  • Ordering photos in Web Gallery

    I would like to impose an arbitrary order on a Web Photo Gallery. What is the recommended practice for doing this? Add a metadata attribute and sort on it? Rename the photos including an order field in the name? I tried simply dragging and dropping.

  • Servlet intercommunication problem

    Hi, I have a problem regarding servlet intercommunication. What I m doing is : I have an HTML form in which user enters some data and submits it. Servlet_1 is called , it gets all the parameters and displays all data in the form of an html form again

  • Query date error

    Hi, I have the following query and it works fine: SELECT partition_name, TO_DATE(SUBSTR(partition_name,-8), 'YYYYMMDD') dt, SUBSTR(partition_name,-8) pd FROM all_tab_partitions WHERE table_owner='TESTUSER' AND table_name='ED_OPERATIONS_LOG'; PARTITIO

  • Input won't work, Headphone jack's gone mono

    A little while back I was doing some home recording running direct into my Macbook. After doing a bass track I lost all direct input signal and ever since I can only hear the left side through the headphone jack. The bass player I was recording faile

  • I am trying to scan a photo on to my computer but every time i try it says i need to update the lcd

    i am trying to scan a photo on to my computer but every time i try it says i need to update the lcd