HTMLDB_collections

I have created a test application on apex.oracle.com:-
http://apex.oracle.com/pls/otn/f?p=20915:1
On page 1: I have the below process:- ON-Load before header
begin
if htmldb_collection.collection_exists(p_collection_name=>'test') then
htmldb_collection.delete_collection(p_collection_name=>'test');
end if;
HTMLDB_COLLECTION.CREATE_COLLECTION(p_collection_name => 'test');
HTMLDB_COLLECTION.ADD_MEMBER(
p_collection_name => 'test',
p_c001 => 'Test1',
p_c002 => 'Test1',
p_c003 => 'Test1',
p_c004 => 'Test1',
p_c005 => 'Test1',
p_c006 => 'Test1',
p_c007 => 'Test1',
p_c008 => 'Test1',
p_c009 => 'Test1',
p_c010 => 'Test1',
p_c011 => 'Test1',
p_c012 => 'Test1',
p_c013 => 'Test1',
p_c014 => 'Test1',
p_c015 => 'Test1');
end;
On page 2:- I have the below on-load before header process.
declare
l_count number;
begin
HTMLDB_COLLECTION.UPDATE_MEMBER(
p_collection_name => 'test',
p_seq => 1,
p_c001 => :P2_TEST_COLLECTION_COUNT,
p_c002 => 'Test1',
p_c003 => 'Test1',
p_c004 => 'Test1',
p_c005 => 'Test1',
p_c006 => 'Test1',
p_c007 => 'Test1',
p_c008 => 'Test1',
p_c009 => 'Test1',
p_c010 => 'Test1',
p_c011 => 'Test1',
p_c012 => 'Test1',
p_c013 => 'Test1',
p_c014 => 'Test1',
p_c015 => 'Test1');
l_count := HTMLDB_COLLECTION.COLLECTION_MEMBER_COUNT (
p_collection_name => 'test' );
end;
I don't know what is wrong with the code, but i am getting the below error:-
ORA-20102: Application collection test does not exist
     Error      
OK      
Please help!!!

Hi,
That's because your link does not pass across the session ID to page 2. A collection is user-session specific, so page 2 does not know that the collection exists as it is in a different session.
Change your link to:
<a href="f?p=&APP_ID.:2:&SESSION.::P2_TEST_COLLECTION_COUNT:10">Go to page 2</a>Andy

Similar Messages

  • How to user HTMLDB_COLLECTIONS in a PL/SQL function?

    Hi!
    I am trying to validate/check that an item from an updateable report is not in a collection before I add the item. I wrote a PL/SQL function to do this. It appears that a "normal" PL/SQL function cannot correctly see the HTMLDB_COLLLECTIONS view. The idea for this was posted to the forum about using a decode statement and a function to detemine whether to display the link value or not for each row. If an item has been added to the collection I want to not display the link. If the item is removed from the collection I need to redisplay the link.
    I have tried validations but they depend on the page being resumbitted. And I tried to force that using a branch where the request was = 'ADD'. However everytime I set it up as a redirect to a URL it kept resetting the branch to a 'branch to a page within this application'.
    Any suggestions on how to check the HTMLDB_COLLECTIONS before it is updated?
    This is V2.0.
    Thanks! Dave Venus

    Hi!
    Yes things work much better when run from within the "application". I had been trying to test the code from both SQL*Plus and from the SQL WorkShop.
    The problem I was having even within the application was that I was getting back NULL return values. So I put some exception handling into the code and trapped the
    data_not_found and others exceptions. I also had SQL%NOTFOUND code in my function. It appears the SQL%NOTFOUND was not being processed and the exception code was. I can paste the code I was using here if you want.
    I went another way around the problem and rewrote the query (esp. the where clause) for the report and it seems to be doing what I need now. I would love to get the function working and understand how it should have worked so that I can use that functionallity in other applications.
    Thanks!
    Dave Venus

  • Htmldb_collection and db read

    Is there a way to force sequential read over scattered read when using htmldb_collection.add_member?
    I have traced an issue with response time to the following section of my code:
    if length(dcg) > 1 then
              htmldb_collection.add_member(
                   p_collection_name => 'DCGCOLLECTION',
                   p_c001 => shuttle_rec.obt_seq_id,
                   p_c002 => dcg,
                   p_generate_md5 => 'NO');
    end if;
    Here is what I am seeing in TKPROF (sorry I can not get the execution report section formatted better). I attempted to recreate the same flow each time, but because I can not predict when the different reads will happen it is difficult. Therefore I have cut and pasted the corresponding sections of the two trace and tkprof output files below.
    You will see that when the system responds as desired, it is using “INDEX RANGE SCAN WWV_FLOW_COLLECTION_MEMBERS_PK” and “db file sequential read”. When response time is slow it uses “INDEX FAST FULL SCAN WWV_FLOW_COLLECTION_MEMBERS_PK” and “db file scattered read”.
    FAST RESPONSE:
    TRACE FILE – just enough to show the collection name (value=)
    SELECT NVL(MAX(SEQ_ID),0) MAXSEQ FROM WWV_FLOW_COLLECTIONS$ C, WWV_FLOW_COLLECTION_MEMBERS$ M WHERE C.SESSION_ID = V('SESSION') AND C.USER_ID = :B4 AND C.SECURITY_GROUP_ID = :B3 AND C.FLOW_ID = :B2 AND C.ID = M.COLLECTION_ID AND C.COLLECTION_NAME = UPPER(:B1 )
    END OF STMT
    PARSE #53:c=0,e=81,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=1,tim=4046522821
    BINDS #53:
    bind 0: dty=1 mxl=2000(255) mal=00 scl=00 pre=00 oacflg=03 oacfl2=206001 size=2080 offset=0
    bfp=091722d4 bln=2000 avl=04 flg=05
    value="RICH"
    bind 1: dty=2 mxl=22(21) mal=00 scl=00 pre=00 oacflg=03 oacfl2=206001 size=0 offset=2000
    bfp=09172aa4 bln=22 avl=09 flg=01
    value=1807302131050935
    bind 2: dty=2 mxl=22(21) mal=00 scl=00 pre=00 oacflg=03 oacfl2=206001 size=0 offset=2024
    bfp=09172abc bln=22 avl=03 flg=01
    value=106
    bind 3: dty=1 mxl=32(13) mal=00 scl=00 pre=00 oacflg=03 oacfl2=206001 size=0 offset=2048
    bfp=09172ad4 bln=32 avl=13 flg=01
    value="DCGCOLLECTION"
    TKPROF –
    SELECT NVL(MAX(SEQ_ID),0) MAXSEQ
    FROM
    WWV_FLOW_COLLECTIONS$ C, WWV_FLOW_COLLECTION_MEMBERS$ M WHERE C.SESSION_ID =
    V('SESSION') AND C.USER_ID = :B4 AND C.SECURITY_GROUP_ID = :B3 AND
    C.FLOW_ID = :B2 AND C.ID = M.COLLECTION_ID AND C.COLLECTION_NAME =
    UPPER(:B1 )
    call count cpu elapsed disk query current rows
    Parse 2 0.00 0.00 0 0 0 0
    Execute 226 0.03 0.07 0 0 0 0
    Fetch 226 0.01 0.03 3 1145 0 226
    total 454 0.04 0.10 3 1145 0 226
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 67 (recursive depth: 2)
    Rows Row Source Operation
    2 SORT AGGREGATE (cr=10 pr=3 pw=0 time=18198 us)
    0 NESTED LOOPS (cr=10 pr=3 pw=0 time=18167 us)
    2 TABLE ACCESS BY INDEX ROWID WWV_FLOW_COLLECTIONS$ (cr=4 pr=0 pw=0 time=277 us)
    2 INDEX UNIQUE SCAN WWV_FLOW_COLLECTIONS_UK (cr=2 pr=0 pw=0 time=238 us)(object id 52046)
    0 INDEX RANGE SCAN WWV_FLOW_COLLECTION_MEMBERS_PK (cr=6 pr=3 pw=0 time=17876 us)(object id 52050)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 3 0.00 0.01
    INSERT INTO WWV_FLOW_COLLECTION_MEMBERS$( COLLECTION_ID, SEQ_ID, C001, C002,
    C003, C004, C005, C006, C007, C008, C009, C010, C011, C012, C013, C014,
    C015, C016, C017, C018, C019, C020, C021, C022, C023, C024, C025, C026,
    C027, C028, C029, C030, C031, C032, C033, C034, C035, C036, C037, C038,
    C039, C040, C041, C042, C043, C044, C045, C046, C047, C048, C049, C050,
    MD5_ORIGINAL )
    VALUES
    ( :B53 , :B52 , :B51 , :B50 , :B49 , :B48 , :B47 , :B46 , :B45 , :B44 , :B43 ,
    :B42 , :B41 , :B40 , :B39 , :B38 , :B37 , :B36 , :B35 , :B34 , :B33 , :B32
    , :B31 , :B30 , :B29 , :B28 , :B27 , :B26 , :B25 , :B24 , :B23 , :B22 ,
    :B21 , :B20 , :B19 , :B18 , :B17 , :B16 , :B15 , :B14 , :B13 , :B12 , :B11 ,
    :B10 , :B9 , :B8 , :B7 , :B6 , :B5 , :B4 , :B3 , :B2 , :B1 )
    call count cpu elapsed disk query current rows
    Parse 1 0.01 0.00 0 0 0 0
    Execute 59 0.12 0.12 7 30 311 59
    Fetch 0 0.00 0.00 0 0 0 0
    total 60 0.14 0.13 7 30 311 59
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 67 (recursive depth: 2)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 6 0.00 0.02
    UPDATE WWV_FLOW_COLLECTIONS$ SET COLLECTION_CHANGED = 'Y'
    WHERE
    ID = :B1 AND COLLECTION_CHANGED = 'N'
    call count cpu elapsed disk query current rows
    Parse 2 0.01 0.00 0 0 0 0
    Execute 226 0.01 0.02 0 452 18 6
    Fetch 0 0.00 0.00 0 0 0 0
    total 228 0.03 0.03 0 452 18 6
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 67 (recursive depth: 2)
    Rows Row Source Operation
    2 UPDATE (cr=4 pr=0 pw=0 time=476 us)
    2 TABLE ACCESS BY INDEX ROWID WWV_FLOW_COLLECTIONS$ (cr=4 pr=0 pw=0 time=66 us)
    2 INDEX UNIQUE SCAN WWV_FLOW_COLLECTIONS_PK (cr=2 pr=0 pw=0 time=38 us)(object id 52045)
    SLOW RESPONSE:
    TRACE FILE – just enough to show the collection name (value=)
    SELECT NVL(MAX(SEQ_ID),0) MAXSEQ FROM WWV_FLOW_COLLECTIONS$ C, WWV_FLOW_COLLECTION_MEMBERS$ M WHERE C.SESSION_ID = V('SESSION') AND C.USER_ID = :B4 AND C.SECURITY_GROUP_ID = :B3 AND C.FLOW_ID = :B2 AND C.ID = M.COLLECTION_ID AND C.COLLECTION_NAME = UPPER(:B1 )
    END OF STMT
    PARSE #39:c=0,e=89,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=1,tim=1298905691
    BINDS #39:
    bind 0: dty=1 mxl=2000(255) mal=00 scl=00 pre=00 oacflg=03 oacfl2=206001 size=2080 offset=0
    bfp=06250cb8 bln=2000 avl=04 flg=05
    value="RICH"
    bind 1: dty=2 mxl=22(21) mal=00 scl=00 pre=00 oacflg=03 oacfl2=206001 size=0 offset=2000
    bfp=06251488 bln=22 avl=09 flg=01
    value=1807302131050935
    bind 2: dty=2 mxl=22(21) mal=00 scl=00 pre=00 oacflg=03 oacfl2=206001 size=0 offset=2024
    bfp=062514a0 bln=22 avl=03 flg=01
    value=106
    bind 3: dty=1 mxl=32(13) mal=00 scl=00 pre=00 oacflg=03 oacfl2=206001 size=0 offset=2048
    bfp=062514b8 bln=32 avl=13 flg=01
    value="DCGCOLLECTION"
    TKPROF –
    SELECT NVL(MAX(SEQ_ID),0) MAXSEQ
    FROM
    WWV_FLOW_COLLECTIONS$ C, WWV_FLOW_COLLECTION_MEMBERS$ M WHERE C.SESSION_ID =
    V('SESSION') AND C.USER_ID = :B4 AND C.SECURITY_GROUP_ID = :B3 AND
    C.FLOW_ID = :B2 AND C.ID = M.COLLECTION_ID AND C.COLLECTION_NAME =
    UPPER(:B1 )
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 224 0.10 0.06 0 0 0 0
    Fetch 224 32.37 603.54 1916959 1923042 0 224
    total 449 32.48 603.61 1916959 1923042 0 224
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 67 (recursive depth: 2)
    Rows Row Source Operation
    224 SORT AGGREGATE (cr=1923042 pr=1916959 pw=0 time=603553959 us)
    6160 NESTED LOOPS (cr=1923042 pr=1916959 pw=0 time=73040535 us)
    224 TABLE ACCESS BY INDEX ROWID WWV_FLOW_COLLECTIONS$ (cr=448 pr=0 pw=0 time=21810 us)
    224 INDEX UNIQUE SCAN WWV_FLOW_COLLECTIONS_UK (cr=224 pr=0 pw=0 time=18572 us)(object id 52046)
    6160 INDEX FAST FULL SCAN WWV_FLOW_COLLECTION_MEMBERS_PK (cr=1922594 pr=1916959 pw=0 time=73009271 us)(object id 52050)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file scattered read 124352 0.03 588.32
    INSERT INTO WWV_FLOW_COLLECTION_MEMBERS$( COLLECTION_ID, SEQ_ID, C001, C002,
    C003, C004, C005, C006, C007, C008, C009, C010, C011, C012, C013, C014,
    C015, C016, C017, C018, C019, C020, C021, C022, C023, C024, C025, C026,
    C027, C028, C029, C030, C031, C032, C033, C034, C035, C036, C037, C038,
    C039, C040, C041, C042, C043, C044, C045, C046, C047, C048, C049, C050,
    CLOB001, MD5_ORIGINAL )
    VALUES
    ( :B54 , :B53 , :B52 , :B51 , :B50 , :B49 , :B48 , :B47 , :B46 , :B45 , :B44 ,
    :B43 , :B42 , :B41 , :B40 , :B39 , :B38 , :B37 , :B36 , :B35 , :B34 , :B33
    , :B32 , :B31 , :B30 , :B29 , :B28 , :B27 , :B26 , :B25 , :B24 , :B23 ,
    :B22 , :B21 , :B20 , :B19 , :B18 , :B17 , :B16 , :B15 , :B14 , :B13 , :B12 ,
    :B11 , :B10 , :B9 , :B8 , :B7 , :B6 , :B5 , :B4 , :B3 , :B2 , :B1 )
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 224 0.39 0.57 190 11 1319 224
    Fetch 0 0.00 0.00 0 0 0 0
    total 225 0.39 0.57 190 11 1319 224
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 67 (recursive depth: 2)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 188 0.00 0.06
    UPDATE WWV_FLOW_COLLECTIONS$ SET COLLECTION_CHANGED = 'Y'
    WHERE
    ID = :B1 AND COLLECTION_CHANGED = 'N'
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 224 0.01 0.03 0 448 12 4
    Fetch 0 0.00 0.00 0 0 0 0
    total 225 0.01 0.03 0 448 12 4
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 67 (recursive depth: 2)
    Rows Row Source Operation
    4 UPDATE (cr=448 pr=0 pw=0 time=9004 us)
    4 TABLE ACCESS BY INDEX ROWID WWV_FLOW_COLLECTIONS$ (cr=448 pr=0 pw=0 time=7205 us)
    224 INDEX UNIQUE SCAN WWV_FLOW_COLLECTIONS_PK (cr=224 pr=0 pw=0 time=4003 us)(object id 52045)
    Thanks for any help.

    Vikas,
         pga_aggregate_target = 25165824
         workarea_size_policy = AUTO
    I have not run statistics on all tables in my development database, so I believe I am operating in Rules Based Optimization.
    However, all pages running against tables in my database operate fine. It is not until I create an htmldb_collection by running a query against another htmldb_collection that I see slow response times.
    Here is an overview of the process, and the steps I went through when tracing:
    User logs in and is brought to the main page.
    User selects “Locate Agreements” from a sidebar menu and is sent to a page with reports region built on the AGREEMENTS table (currently 450 rows in development).
    User selects “Costa Rica” from a select list of terminating countries and the page is submitted and refreshed showing only Costa Rica agreements.
    User clicks on the ‘Edit’ link for an agreement and is sent to the details page for the selected record.
         Now that a specific agreement has been selected, this page fires the on-demand process “load tier collections” on load, after footer. This process is viewable by going to http://htmldb.oracle.com/pls/otn/f?p=23228:2:218044503435049191::::: and downloading. Processing time to this point is fine.
    User selects “Tiers” from the sidebar menu and is sent to a page built on the htmldb_collection OBTCOLLECTION which was created by the load tier collections process.
         Here is where the delay occurs. This page fires the on-demand process “load shuttle collections” on load, after footer. This process is viewable by going to http://htmldb.oracle.com/pls/otn/f?p=23228:2:218044503435049191::::: and downloading. This process creates multiple htmldb_collections for use on the next page. Using a cursor to move through the OBTCOLLECTION (created earlier), four fields, each containing semi-colon delimited strings, are parsed and the values are inserted into the appropriate collections (DCGCOLLECTION, CITYCOLLECTION, PRODCOLLECTION, PRDCOLLECTION). It would appear, after looking at the trace files, that the creation of the DCGCOLLECTION is causing the biggest delay. This page will load in seconds when operating correctly, but takes as much as 10 minutes when it is not. I have seen this happen at all times of the day, and there is nothing else (nor anyone else) running on the server.
    Richard

  • APEX 2.2.1 upgrade - htmldb_collection.create_collection_from_query problem

    We have recently upgraded a production application from 1.6 to 2.2.1 and have found a problem creating a collection from a query in a before header process. The page no longer displays and we eventually get the standard http request failed message after over 60 seconds. I have traced this session and the process appears to hang after parsing then executing the cursor i.e. does not fetch the results.
    The SQL is based on a view that uses connect by prior and runs fine within SQL+ (under 1 second to return 63 rows). Other queries passed to the API appear to work fine whether they are based on tables and/or views. Have also tried changing the reference to apex_collection but still get the same issue.
    Have changed the shared_pool_size to 100M as recommended for the upgrade.
    Has anyone experienced a similar issue or can recommend a better/alternative method to achieve the following:
    if ( htmldb_collection.collection_exists( v_collection_name ) )
    then
    htmldb_collection.delete_collection( v_collection_name );
    else
    htmldb_collection.create_collection_from_query
    (p_collection_name => v_collection_name ,
    p_query => 'select distinct
    t.customer_id --1
    , t.fiscal_year --2
    , t.financial_header_id --3
    , t.financial_item_id --4
    , t.sequence --5
    , t.code --6
    , t.description --7
    , t.is_title --8
    , t.is_item --9
    , t.is_negative --10
    , t.is_hidden --11
    , t.connect_by_isleaf --12
    , null this_year_minus_0 --13
    , null this_year_minus_1 --14
    , null this_year_minus_2 --15
    from financial_statements t where ( t.is_hidden = 0 )');
    end if;
    Thanks, Ian

    Daniel,
    That API is meant to be used from within an application, from a page process, for example. So I would expect an error from where you are calling it. (Disregard browser language question.)
    When you said:
    Our production version are 2.0.0.00.49 because we have a 9.2 database.
    ...what do you mean? You can use any version of Application Express with 9.2.0.3 or higher database.
    Scott

  • Problem with htmldb_collection

    I am using a collection to store tabular form values. The code for my 'for' loop that adds the collection members is:
    htmldb_collection.create_or_truncate_collection('UPDATE_PRMI');
    for i in 1..htmldb_application.g_f01.count
      loop
        if htmldb_application.g_f01(i) is not null then
          htmldb_collection.add_member(
              p_collection_name => 'UPDATE_PRMI',
              p_c001            => htmldb_application.g_f01(i),
              p_c002            => htmldb_application.g_f02(i),
              p_c003            => htmldb_application.g_f04(i),
              p_c004            => htmldb_application.g_f08(i),
              p_c005            => htmldb_application.g_f09(i));
        end if;
      end loop;I am using the same loop as seen here: http://www.oracle.com/technology/products/database/application_express/howtos/tabular_form.html
    For some reason, it is never getting into the 'for' loop. If I put a debugging statement before the 'for' loop, the debug statement runs, but if I put it inside the 'for' loop, it doesn't run. Can anyone tell right off hand why this is not working?

    My code looks very similar to yours, Bill, but mine is still producing a "no data found" ORA error when the page is submitted and the process is supposed to run.
    Could this be a version difference? I am running v2.2.1.00.04 of APEX. Perhaps this version does not like the apex_application and requires me to use htmldb_application.
    Here is my code for the process. Maybe someone can spot something in it that might be causing the "no data found error."
    declare
      v_ifirst  number := 0;
      v_mtg_strt_time  date;
    begin
    apex_collection.create_or_truncate_collection(p_collection_name      => 'UPDATE_PRMI');
    for i in 1..apex_application.g_f01.count
      loop
          apex_collection.add_member(
              p_collection_name => 'UPDATE_PRMI',
              p_c001            => htmldb_application.g_f01(i), -- Meeting Item ID
              p_c002            => htmldb_application.g_f02(i), -- Sequence Number
              p_c003            => htmldb_application.g_f04(i), -- Meeting ID
              p_c004            => htmldb_application.g_f08(i), -- Presenation Start Time
              p_c005            => htmldb_application.g_f09(i)); -- Presentation Duration
    insert into SEQUENCING_DEBUG values (5);
    commit;
      end loop;
    for i in (select c001, c002, c003, c004, c005
    from apex_collections
    where collection_name = 'UPDATE_PRMI'
    order by c002)
      loop   
          if v_ifirst = 0 then 
              select review_date into v_mtg_strt_time 
                from phase_review_meeting
                where PHASE_REVIEW_MEETING_ID = i.c003;     
              update phase_review_meeting_item
              set presentation_start_time = v_mtg_strt_time
              where pr_meeting_item_id = i.c001;
              commit;
              insert into SEQUENCING_DEBUG values (1);
              commit;
              v_ifirst := 1;
              select ((i.c005/1440) + v_mtg_strt_time) into v_mtg_strt_time
              from phase_review_meeting_item
              where pr_meeting_item_id = i.c001;
           else
             update phase_review_meeting_item
             set presentation_start_time = v_mtg_strt_time
             where pr_meeting_item_id = i.c001;
             commit;
             insert into SEQUENCING_DEBUG values (2);
             commit;
             select ((i.c005/1440) + v_mtg_strt_time) into v_mtg_strt_time
             from phase_review_meeting_item
             where pr_meeting_item_id = i.c001;
           end if;
      end loop;
    end;Thanks!
    BoilerUP

  • Select List not updated by htmldb_collection

    I used the Collection Showcase as a template to do a collection, When I edit a collection Record from a populated form that contains a select list. when I changed the value in the select list and processed htmldb_collection.update_member API, the report that displays the values in the collection retains the old value for that record when the new value is in the session state.
    Note: Also the Collection Update fails on occasion display the Error Collection_Name cannot be Null. Why would this occur?

    How do I generate all the page item attributes to send you? What do you mean by "see the page" - do you want me to submit the generated HTML source?
    In the meantime, I have dropped the select list item and am now re-creating it as follows:
    - Click the Item Create icon
    - Choose Select List
    - For Select List Control Type, accept the default of Select List and click Next.
    - Item name = P1_SALESMANAGER_SHOW and click Next
    - Choose a named LOV, enter null value / text and click Next
    - Accept default item attributes and click Next, then Create Item
    This is exactly in accordance with the instructions for the example page in Chapter 2 of the 2-day Tutorial.
    Run the page, exactly the same result. Clicking Debug shows that P1_SALESMANAGER_SHOW .value is set to null, even though I have picked one of the displayed values.
    I need to do a proof-of-technology demo of HTMLDB to my managers this week so would really appreciate your advice to get this going.
    Thanks,
    Andy

  • HTMLDB_COLLECTION.MERGE_MEMBERS

    L.S.,
    I created a SQL Query (updateable report) region based on a collection: 'X'.
    The collection is created in a page process which is executed On Load - Before Header:
    if HTMLDB_COLLECTION.COLLECTION_EXISTS( p_collection_name => 'X' )
    then
    HTMLDB_COLLECTION.DELETE_COLLECTION( p_collection_name => 'X );
    end if;
    HTMLDB_COLLECTION.CREATE_COLLECTION_FROM_QUERY(
    p_collection_name => 'X',
    p_query => 'select * from x' );
    To update the collection when someone makes any changes to the collection-member-attributes, I created a page process:
    /* collect the original values */
    for r in ( select * from htmldb_collections where collection_name = 'X' )
    loop
    /* compare these values with the 'report-values' */
    if nvl(r.c001,'#') <> nvl(htmldb_application.g_f02(i),'#')
    then
    /* the values is changed, so update the member-attribute */
    htmldb_collection.update_member_attribute( 'X',
    r,
    1,
    p_attr_value => htmldb_application.g_f02(i));
    end if;
    if nvl(r.c002,'#') <> nvl(htmldb_application.g_f03(i),'#')
    then
    htmldb_collection.update_member_attribute( 'X',
    r,
    2,
    p_attr_value => htmldb_application.g_f03(i));
    end if;
    If there are 40 attributes then this way it is a lot of programming.
    Can someone 'tell me more' about HTMLDB_COLLECTION.MERGE_MEMBERS?
    How exactly (which arguments etc.) does one call this procedure?
    Has someone used it before? Is there an example?
    Thanks,
    Jos

    Jos,
    Here is an example of calling the merge_members procedure. I didn't test it though, see if it makes sense to you:declare
        l_f01 wwv_flow_global.vc_arr2;
        l_c001 wwv_flow_global.vc_arr2;
        l_c002 wwv_flow_global.vc_arr2;
    begin
        -- existing collection contains c001 and c002 values for elements 1,2,3,4,5
              l_f01(1) := '1'; -- keep elements at index position 1
              l_f01(2) := '3'; -- keep elements at index position 3
              l_f01(3) := '5'; -- keep elements at index position 5
              l_f01(4) := '6'; -- insert elements at index position 6
              -- collection elements at index positions 2 and 4 will be deleted
              -- set elements to be updated
              l_c001(1) := 'upd-attr1';
              l_c002(1) := 'upd-attr2';
              l_c001(3) := 'upd-attr1';
              l_c002(3) := 'upd-attr2';
              l_c001(5) := 'upd-attr1';
              l_c002(5) := 'upd-attr2';
              -- set new elements to insert
              l_c001(6) := 'ins-attr1';
              l_c002(6) := 'ins-attr2';
              htmldb_collection.merge_members (
                  p_collection_name =>'TEST_COLL',
                  p_seq             l_f01,
                  p_c001            l_c001,
                  p_c002            l_c002);
    end;Scott

  • Problems with Collections using, HTMLDB_COLLECTIONS

    Hello everybody,
    I get strange problemss using the HTMLDB_COLLECTION. I want my collection to hold temporary data before the final insert or update processes. I have this list of persons with their name, phone number and phione extension number. This is quite simple and it works well on my form A. I have no problems, I can update, add, delete without any trouble.
    The content of my collections are showed in a status region. To edit the collection, I call a popup to fill the data. I can do all the operations there. But now I have a Form B which is an other version of FORM A, it's using the same code and popup window to alter the collections's information. But for a reason I do not understand. It's not working at all. It's the same popup page who is calling :
    HTMLDB_COLLECTION.DELETE_MEMBER(
    p_collection_name => collection name,
    p_seq => member sequence number);
    HTMLDB_COLLECTION.ADD_MEMBER(
    p_collection_name => collection name,
    p_c001 => [member attribute 1],
    p_c002 => [member attribute 2],
    p_c003 => [member attribute 3],
    p_c004 => [member attribute 4],
    p_c005 => [member attribute 5],
    p_c006 => [member attribute 6],
    p_c007 => [member attribute 7],
    p_c050 => [member attribute 50]);
    p_clob001 => [CLOB member attribute 1],
    p_generate_md5 => YES or NO);
    HTMLDB_COLLECTION.UPDATE_MEMBER (
    p_collection_name => collection name,
    p_seq => member sequence number,
    p_c001 => member attribute 1,
    p_c002 => member attribute 2,
    p_c003 => member attribute 3,
    p_c004 => member attribute 4,
    p_c005 => member attribute 5,
    p_c006 => member attribute 6,
    p_c007 => member attribute 7,
    p_c050 => member attribute 50);
    p_clob001 => [CLOB member attribute 1],
    etc ...
    If this works for page A, why it doesn't work for page B, when both pages use the same collections and popup window ?
    Thank you for your help.
    leinadjan
    Edited by: user13047323 on 2010-04-27 11:31

    Chantale,
    One thing jumped out at me there, that you might want to double-check -
    HTMLDB_COLLECTION.CREATE_COLLECTION_FROM_QUERY_B(
    p_collection_name => 'ApprobateurSelect',
    p_query => 'select approbateur.PEIN,
    approbateur.niveau_approbation,
    groupe.code_groupe
    from approbateur, usager, groupe
    where APPROBATEUR.PEIN = USAGER.PEIN
    AND approbateur.code_tache = :12_CODE_TACHE_HIDDEN');Is your item really called 12_CODE_TACHE_HIDDEN? Or should that be P12_CODE_TACHE_HIDDEN?
    If that item name is correct, then I would actually put the query itself into a variable, just so that it's easier on the eye to read and make sure there are no error in the query itself (can you run it from SQLPlus etc), then pass the variable into the CREATE_COLLECTION_FROM_QUERY_B procedure instead.

  • HTMLDB_COLLECTION 2.0

    Did 'HTMLDB_COLLECTION.CREATE_OR_TRUNCATE_COLLECTION' go away in HTMLDB 2.0? I just upgraded to 2.0 and now I get PLS-00201: identifier 'HTMLDB_COLLECTION.CREATE_OR_TRUNCATE_COLLECTION' must be declared error.
    Thanks,
    Randy

    Randy,
    The procedure create_or_truncate_collection is in HTML DB 2.0 and hasn't changed.
    All you did was perform an upgrade to HTML DB 2.0 and an application that previously was working now fails? Were there any errors during the upgrade? Is there a public synonym created for HTMLDB_COLLECTION?
    Joel

  • Regarding HTMLDB_COLLECTION.CREATE_COLLECTION_FROM_QUERY

    Hi,
    I try to create collection and I use this piece of code:
    HTMLDB_COLLECTION.CREATE_COLLECTION_FROM_QUERY(
    p_COLLECTION_NAME => 'COMMENTS_COLLECTION',
    p_QUERY => 'SELECT
    ed.severity "Severity",
    rownum "Number",
    ed.id
    from
    external_defect ed
    where ed.OBJ_ID=:P156_OBJ_ID
    and ed.pro_id = :P156_PRO_ID'
    But while running this query I am getting the following error.
    " create_collection_from_query Error:ORA-20104: create_collection_from_query ParseErr:ORA-00942: table or view does not exist) "
    But In SQLWORKSHOP I am able to run SELECT query for this table.
    Please help me regarding the same
    Thanks

    "user554934",
    This may not be completely obvious from the documentation, but I don't believe the bind variables in your query are being processed in create_collection_from_query. Can you try this via the v() function?
    As in:
    HTMLDB_COLLECTION.CREATE_COLLECTION_FROM_QUERY(
    p_COLLECTION_NAME => 'COMMENTS_COLLECTION',
    p_QUERY => 'SELECT
    ed.severity "Severity",
    rownum "Number",
    ed.id
    from
    external_defect ed
    where ed.OBJ_ID=v(''P156_OBJ_ID'')
    and ed.pro_id = v(''P156_PRO_ID'')'
    );Joel

  • Question about HTMLDB_COLLECTION.CREATE_COLLECTION_FROM_QUERY

    Actually 2 questions:
    1) I have a query which normally runs for about 10-20 seconds and returns over a million records. When I use this query with HTMLDB_COLLECTION.CREATE_COLLECTION_FROM_QUERY in a page in on load before header process, the page times out. If a put some restriction in the query and bring the number of records down to about 100 000 it goes through. Is this normal? Shouldn't I be using this technique with large queries?
    2) I have successfully used HTMLDB_COLLECTION.CREATE_COLLECTION_FROM_QUERY in a package which is called from Apex page, but when I try to run a script containing HTMLDB_COLLECTION.CREATE_COLLECTION_FROM_QUERY in TOAD in the same schema where my Apex applications are parsed I get the following error:
    ORA-20104: create_collection_from_query Error:ORA-20001: Invalid parsing schema for current workspace ID
    ORA-06512: at "FLOWS_030100.WWV_FLOW_COLLECTION",
    Can somebody shed some light on this please!
    George

    Hi George,
    I don't know exactly what the method actually does (a DBA may be able to view the package body code to determine this) but I would have thought that it would at least double the time taken to run the query directly in SQL - once to run the query and the second time to populate the collection. Once created, though, any computations done to get the results for the reports would be a lot slower than using normal SQL data as aggregation and filters could not use indexes that should exist on the tables.
    One possibly, which I haven't yet used myself, would be Materialized Views - see: [http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_6002.htm#sthref6657] - though this may depend on the frequency of updates on the underlying tables as this would, of course, mean additional overheads when inserting/updating/deleting data. You can have indexes on these views, so that would help with the reports.
    Another possibility would to be to have a scheduled job that analyses the tables on a regular basis and generates snapshots in secondary tables that you could then base your reports on. We actually use this method in our office to do daily snapshots of financial data - these are scheduled to run overnight so that they do not slow down normal operations.
    If you wanted to see how long it would take to generate the collection, search the forum for "Processing" and you should find examples of pages that use the Processing graphic (like you see if you install an application into Apex for example). You could apply that to your page and then time it until you get the results
    Andy

  • How does HTMLDB_COLLECTION.MOVE_MEMBER_DOWN work?

    I'm trying to move members of a collection up and down, but the HTMLDB_COLLECTION.MOVE_MEMBER_DOWN and HTMLDB_COLLECTION.MOVE_MEMBER_UP functions have some interesting behavior. When I call the MOVE_MEMBER_DOWN function for an item, it moves two items down. One of them which I want to move, and one before it. So the item which should be swaped with my item, is moved up by two places. The MOVE_MEMBER_UP function do the same in the opposite direction, except for the first time, when it moves the item by one place down, like MOVE_MEMBER_DOWN should do it correctly. I guess this is not the correct behavior. Does anybody have any idea why does it work like this?
    Lajos

    Lajos,
    This is not the behavior of these procedures. Are you sure that how aren't calling these procedures twice in succession in your application?
    If possible, please reproduce this on htmldb.oracle.com and I'll take a look.
    Joel

  • When can I find the APIs about htmldb_collection(wwv_flow_collection)?

    When can I find the APIs about htmldb_collection(wwv_flow_collection)?When I update some members to a collection,error occurs:
    ' wwv_flow_collection.update_member(
    p_collection_name => 'precontract',
    p_c001 => :P9_PRE_DATE,
    p_c002 => :P9_PRE_TIME);'
    How can I deal with it?I need update some members to the colletion by then collection name.
    Thanks for any help.

    "lastgod god",
    The HTML DB collections API is documented in Chapter 12, "Advanced Programming Techniques", in the Oracle HTML DB User's Guide.
    It appears you're missing the p_seq parameter in your call to update_member. update_member() operates on a single member of a collection, hence, you need to specify which member via the p_seq parameter.
    Joel

  • Javascript and HTMLDB_COLLECTION

    Is there any possible way to reference the c001, c002, .... items from a collection created in a PL/SQL process?
    You can reference items from a table, like document.wwv_flow.f01[0].value, but I can not find anything about accessing collections.
    I would like to edit the collection data from some javascript functions rather than PL/SQL statements
    -Mux

    Mux,
    If you want to reference something in javascript you need to get it on the page. Creating a collection only puts the data into a table within the database. If you want to get it on a page, I recommend creating a report on the collection. If you don't want to display any of the collection you can use a div tag and set the display:none (look at a hide/show region for the syntax).
    So, create a region template that doesn't show (using a div tag &lt;div style="display:none"&gt; or whatever convention you like).
    Create a report of your collection using that template. The results of the report will be on the page but not visible. Now, to actually reference this data it will need to be referencable. You could make each item a text item or hidden item (it won't matter because it won't show anyway). I would probably use the apex_item.hidden API to create the items, that way you can give every item a unique ID.
    If this isn't enough detail, let me know and I'll post a query for you.
    Anton

  • LOV not being applied to a column

    Problem: The first query runs quite fast as it is soft parsed, but the LOV values are not applied to the resulting values in the column CHECK_MARK. The second query is hard parsed (and slow due to that) but has its LOV value properly realized. The LOV being applied changes 0/NULL to white space and the 1 is a graphical checkmark.
    For this situation an LOV is being applied to a column named "CHECK_MARK'. The column will have a value of 0/NULL or 1 if the row (employee) is in the source table (SCHEMA.EMPLOYEE_V) has its primary id (EMP_ID) in a collection named 'SELECTED_EMP_IDS'. The only values inside the collection is C001 storing the EMP_ID value of every employee selected.
    --Works fast, but the report renders with 0/NULL and 1's instead of nothing for 0/NULL and an IMG tag for a value of 1.
    SELECT
    EMP_ID,
    NVL((SELECT 1 FROM HTMLDB_COLLECTIONS WHERE C001 = EMPLOYEE_ID AND COLLECTION_NAME = ''SELECTED_EMP_IDS''),0) AS CHECK_MARK FROM SCHEMA.EMPLOYEE_V;
    --Slow, but the img tag is properly output from the LOV.
    SELECT
    EMP_ID
    0 CHECK_MARK FROM SHEMA.EMPLOYEE_V
    LEFT JOIN (SELECT 1 CHECK_MARK FROM DUAL) ON (EMP_ID) IN (SELECT C001 FROM HTMLDB_COLLECTIONS WHERE COLLECTION_NAME = 'SELECTED_EMP_IDS';
    Any reason for this or is there another way to format the query so it is both soft parsed and have the LOV properly output?

    There is a collection, with C001 having some number of EMP_ID’s in it.
    COLLECTION_NAME = ‘SELECTED_EMP_IDS’
    C001
    27
    32
    52
    70Both of the following queries will return the same data:
    (Query 1)
    SELECT
    EMP_ID,
    NVL((SELECT 1 FROM HTMLDB_COLLECTIONS WHERE C001 = EMPLOYEE_ID AND COLLECTION_NAME = ''SELECTED_EMP_IDS''),0) AS CHECK_MARK FROM SCHEMA.EMPLOYEE_V;
    (Query 2)
    SELECT
    EMP_ID
    0 CHECK_MARK FROM SHEMA.EMPLOYEE_V
    LEFT JOIN (SELECT 1 CHECK_MARK FROM DUAL) ON (EMP_ID) IN (SELECT C001 FROM HTMLDB_COLLECTIONS WHERE COLLECTION_NAME = 'SELECTED_EMP_IDS';
    EMP_ID         |       CHECK_MARK         |     ...
      10               0
      15               0
      27               1
      32               1
      52               1
      70               1
    110               0Where all the 1's in the checkmark column are also contained within the collection above. This query is used to render a report. The CHECK_MARK column in the report has a static LOV applied to it.
    CHECK_MARK_LOV:
         Return Value     Display Value
         0                
         1          &lt;img src="/i/check_small_black.gif"&gt;When the page is run using Query 1, the CHECK_MARK column will display 0's and 1's. When running the page with the report having the source of Query 2, the LOV will be properly applied and the 0's will become white space and 1's will become &lt;img src="/i/check_small_black.gif"&gt;..
    I am just trying to figure out why Query 1 makes it so the CHECK_MARK column is rendered with the return value of the LOV while Query 2 renders the CHECK_MARK column with the proper LOV display value.

Maybe you are looking for