Apex_collection.add_member

I have two scenarios for a commercial fisheries application I am designing. The pressure is on, as that NOAA is very interested in APEX, but leaning toward a PC version. ugh.
scenario 1 - FAVORITE - user creates a list of frequently caught species. The collection CATCH_C is created and populated with these species. I have an ADD button to add a new species. 3 records are created, one being a copy of an existing record (not certain why). I edit that record and it fails when I go to save with the error:
ORA-20103: Member sequence does not exist in application collection "CATCH_C"
scenario 2 - SINGLE
a fisherman does not have favorite species. I create collection CATCH_C. An empty row appears. I fill in the data and press ADD to create a second row. The first row is blanked out, and a second row appears
The following error appears:
report error:
ORA-06550: line 1, column 376:
PL/SQL: ORA-00933: SQL command not properly ended
ORA-06550: line 1, column 7:
PL/SQL: SQL Statement ignored
My report query is complicated because I have cascading LOVs (though I have not been able to get them to work).
Scenaria FAVORITE has report of:
select
apex_item.hidden(11,seq_id) seq,
apex_item.hidden (12,seq_id)||
apex_item.select_list_from_query_XL(13,c013,'select distinct s.common_name d, s.species_itis r
from species s, species_qc c
where partner_id = '||:f200_issuing_agency||' and
c.species_itis = s.species_itis order by s.common_name',
'style="width:220px" '
|| 'onchange="f_set_casc_sel_list_item(this,'
|| 'f16_'
|| LPAD (seq_id, 4, '0')
|| ')"',
'YES',
'0',
'- Select Species -',
'f13_' || LPAD (seq_id,4, '0'),
NULL,
'NO'
) SPECIES_ITIS,
apex_item.select_list_from_query(14,c014,'select disposition_desc d, disposition_code r
from dispositions
where displayed = 1 order by disposition_desc') DISPOSITION_CODE,
apex_item.text(15,c015) reported_quantity,
apex_item.select_list_from_query(16,c016,'SELECT DISTINCT unit_desc ,unit_of_measure
FROM species_Qc s, units_of_measure u
WHERE s.unit_of_measure = u.unit_measure
AND species_itis = '||c013||' AND partner_id = '||:F200_ISSUING_AGENCY,
'style="width:220px"',
'YES',
'0',
'- Select Unit -',
'f13_' || LPAD (seq_id, 4, '0'),
NULL,
'NO' ) UNIT_MEASURE,
apex_item.SELECT_LIST_FROM_LOV(17,c017,'SALE_DISPOSITION') SALE_DISPOSITION_FLAG,
apex_item.text(18,c018) PRICE,
apex_item.text(19,c019) PERMIT_ID,
apex_item.select_list_from_query(20,c020,'select market_desc d, market_code r
FROM market_categories
where market_code in (select distinct market_code
from species_qc
where species_itis = '||c013||'
and partner_id = '||:F200_ISSUING_AGENCY||')',
'style="width:220px"',
'YES',
'0',
'- Select Market -',
'f20_' || LPAD (seq_id, 4, '0'),
NULL,
'NO' ) MARKET_CODE,
apex_item.text(21,c021) GRADE_CODE,
apex_item.hidden(22,c022) trip_id
from apex_collections c
where collection_name = 'CATCH_C' and
c.c022 = :F200_CURRENT_TRIP_ID
UNION ALL
select
apex_item.hidden(11,null) seq,
apex_item.hidden (12,null)||
apex_item.select_list_from_query_XL(13,0,'select distinct s.common_name d, s.species_itis r
from species s, species_qc c
where partner_id = '||:f200_issuing_agency||' and
c.species_itis = s.species_itis order by s.common_name',
'style="width:220px" '
|| 'onchange="f_set_casc_sel_list_item(html_SelectValue(this),'
|| 'f16_'
|| LPAD (9900 + LEVEL, 4, '0')
|| ')"',
'YES',
'0',
'- Select Species -',
'f13_' || LPAD (9900 + LEVEL,4, '0'),
NULL,
'NO'
) SPECIES_ITIS,
apex_item.select_list_from_query(14,null,'select disposition_desc d, disposition_code r
from dispositions
where displayed = 1 order by disposition_desc') DISPOSITION_CODE,
apex_item.text(15,null) reported_quantity,
apex_item.select_list_from_query(16,null,'SELECT DISTINCT unit_desc ,unit_of_measure
FROM species_Qc s, units_of_measure u
WHERE s.unit_of_measure = u.unit_measure
AND species_itis = '||0||'AND partner_id = '||:F200_ISSUING_AGENCY,
'style="width:220px"',
'YES',
'0',
'- Select Unit -',
'f13_' || LPAD (9900 + LEVEL, 4, '0'),
NULL,
'NO' ) UNIT_MEASURE,
apex_item.SELECT_LIST_FROM_LOV(17,null,'SALE_DISPOSITION') SALE_DISPOSITION_FLAG,
apex_item.text(18,null) PRICE,
apex_item.text(19,null) PERMIT_ID,
apex_item.select_list_from_query(20,null,'select market_desc d, market_code r
FROM market_categories
where market_code in (select distinct market_code
from species_qc
where species_itis = '||0||'
and partner_id = '||:F200_ISSUING_AGENCY||')',
'style="width:220px"',
'YES',
'0',
'- Select Market -',
'f20_' || LPAD (9900 + LEVEL, 4, '0'),
NULL,
'NO' ) MARKET_CODE,
apex_item.text(21,null) GRADE_CODE,
apex_item.hidden(22,null) trip_id
FROM DUAL
WHERE :request = 'ADD'
CONNECT BY LEVEL = 2
Scenario SINGLE has report of:
select
apex_item.hidden(11,seq_id) seq,
apex_item.hidden (12,seq_id)||
apex_item.select_list_from_query_XL(13,c013,'select distinct s.common_name d, s.species_itis r
from species s, species_qc c
where partner_id = '||:f200_issuing_agency||' and
c.species_itis = s.species_itis order by s.common_name',
'style="width:220px" '
|| 'onchange="f_set_casc_sel_list_item(this,'
|| 'f16_'
|| LPAD (seq_id, 4, '0')
|| ')"',
'YES',
'0',
'- Select Species -',
'f13_' || LPAD (seq_id,4, '0'),
NULL,
'NO'
) SPECIES_ITIS,
apex_item.select_list_from_query(14,c014,'select disposition_desc d, disposition_code r
from dispositions
where displayed = 1 order by disposition_desc') DISPOSITION_CODE,
apex_item.text(15,c015) reported_quantity,
apex_item.select_list_from_query(16,c016,'SELECT DISTINCT unit_desc ,unit_of_measure
FROM species_Qc s, units_of_measure u
WHERE s.unit_of_measure = u.unit_measure
AND species_itis like '||c013||'''%'' AND partner_id = '||:F200_ISSUING_AGENCY,
'style="width:220px"',
'YES',
'0',
'- Select Unit -',
'f13_' || LPAD (seq_id, 4, '0'),
NULL,
'NO' ) UNIT_MEASURE,
apex_item.SELECT_LIST_FROM_LOV(17,c017,'SALE_DISPOSITION') SALE_DISPOSITION_FLAG,
apex_item.text(18,c018) PRICE,
apex_item.text(19,c019) PERMIT_ID,
apex_item.select_list_from_query(20,c020,'select market_desc d, market_code r
FROM market_categories
where market_code in (select distinct market_code
from species_qc
where species_itis like '||c013||'''%''
and partner_id = '||:F200_ISSUING_AGENCY||')',
'style="width:220px"',
'YES',
'0',
'- Select Market -',
'f20_' || LPAD (seq_id, 4, '0'),
NULL,
'NO' ) MARKET_CODE,
apex_item.text(21,c021) GRADE_CODE,
apex_item.hidden(22,c022) trip_id
from apex_collections c
where collection_name = 'CATCH_C' and
c.c022 = :F200_CURRENT_TRIP_ID
UNION ALL
select
apex_item.hidden(11,null) seq,
apex_item.hidden (12,null)||
apex_item.select_list_from_query_XL(13,0,'select distinct s.common_name d, s.species_itis r
from species s, species_qc c
where partner_id = '||:f200_issuing_agency||' and
c.species_itis = s.species_itis order by s.common_name',
'style="width:220px" '
|| 'onchange="f_set_casc_sel_list_item(html_SelectValue(this),'
|| 'f16_'
|| LPAD (9900 + LEVEL, 4, '0')
|| ')"',
'YES',
'0',
'- Select Species -',
'f13_' || LPAD (9900 + LEVEL,4, '0'),
NULL,
'NO'
) SPECIES_ITIS,
apex_item.select_list_from_query(14,null,'select disposition_desc d, disposition_code r
from dispositions
where displayed = 1 order by disposition_desc') DISPOSITION_CODE,
apex_item.text(15,null) reported_quantity,
apex_item.select_list_from_query(16,null,'SELECT DISTINCT unit_desc ,unit_of_measure
FROM species_Qc s, units_of_measure u
WHERE s.unit_of_measure = u.unit_measure
AND species_itis = '||0||'AND partner_id = '||:F200_ISSUING_AGENCY,
'style="width:220px"',
'YES',
'0',
'- Select Unit -',
'f13_' || LPAD (9900 + LEVEL, 4, '0'),
NULL,
'NO' ) UNIT_MEASURE,
apex_item.SELECT_LIST_FROM_LOV(17,null,'SALE_DISPOSITION') SALE_DISPOSITION_FLAG,
apex_item.text(18,null) PRICE,
apex_item.text(19,null) PERMIT_ID,
apex_item.select_list_from_query(20,null,'select market_desc d, market_code r
FROM market_categories
where market_code in (select distinct market_code
from species_qc
where species_itis = '||0||'
and partner_id = '||:F200_ISSUING_AGENCY||')',
'style="width:220px"',
'YES',
'0',
'- Select Market -',
'f20_' || LPAD (9900 + LEVEL, 4, '0'),
NULL,
'NO' ) MARKET_CODE,
apex_item.text(21,null) GRADE_CODE,
apex_item.hidden(22,null) trip_id
FROM DUAL
WHERE :request = 'ADD'
CONNECT BY LEVEL = 2
Incidently, the cascades have never worked if a change is made on a species and I had originally had just one query to handle both scenarios but that did not work. Something with the LIKE '||co13||'%
thanks!

I think this may be resolved. I changed CONNECT BY 2 to CONNECT by 1 in the report query. Now both scenarios appear to work using the same query...just need to figure out the cascading LOV. thanks

Similar Messages

  • Apex_collection.add_member in-efficiencies

    http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21674/advnc_collections.htm#BABFFJJJ
    Collections enable you to temporarily capture one or more nonscalar values. You can use collections to store rows and columns currently in session state so they can be accessed, manipulated, or processed during a user's specific session. You can think of a collection as a bucket in which you temporarily store and name rows of information.Dummy table to test with
    CREATE TABLE  "TEST1"
       ("A" VARCHAR2(4000),
        "B" VARCHAR2(4000)
       ) ;Collection process:
    declare
        c_collection_name constant varchar2(20) := 'PERFORMANCE_TEST';
    l_start_time NUMBER;
    begin
        APEX_COLLECTION.CREATE_OR_TRUNCATE_COLLECTION(p_collection_name => c_collection_name);
    l_start_time := DBMS_UTILITY.get_cpu_time;
        FOR i in 1..10000 LOOP
                APEX_COLLECTION.ADD_MEMBER(
                                p_collection_name => c_collection_name,
                                p_c001 => 'cola'||i,
                                p_c002 => 'colb'||i);
        END LOOP;
    :P1_TIMING := (DBMS_UTILITY.get_cpu_time - l_start_time)/100 || ' secs';
    end;Insert Process
    declare
    l_start_time NUMBER;
    begin
    delete from test1;
    l_start_time := DBMS_UTILITY.get_cpu_time;
        FOR i in 1..10000 LOOP
    insert into test1 values ('cola'||i, 'colb'||i);
        END LOOP;
    :P1_TIMING := (DBMS_UTILITY.get_cpu_time - l_start_time)/100 || ' secs';
    end;on apex.oracle.com, I experienced:
    - Collection: ~6-7 seconds
    - Inserts: ~0.25 seconds
    Seems like add_member shouldn't be use for storing large volumes of data (10 000 isn't exactly a large volume, and the results are quite skewed).

    I found the problem -- in case it helps someone else, I just needed to add all three items to "Page Items to Submit" in the DA that calls add_member.

  • Apex_collection.add_member not adding all fields

    I am trying to add the contents of three page items into a collection, and to verify, I queried the collection for the three fields and output them to other page items. The problem is, only one field returns a value.
    Background:
    I set up the collection in a Page Process that runs On Load - Before Header:
    apex_collection.create_or_truncate_collection
      (p_collection_name => 'FILTER');
    Then, I created a form with three items: P2_TABLE, P2_COLUMN, and P2_COLUMN_TYPE. The "Create" button triggers a dynamic action with 4 True actions.
    The first one adds the item values to the collection:
    apex_collection.add_member(p_collection_name => 'FILTER',
        p_c001 => :P2_TABLE,
        p_c002 => :P2_COLUMN,
        p_c003 => :P2_COLUMN_TYPE);
    The other three actions output the values of P2_TABLE, P2_COLUMN, and P2_COLUMN_TYPE to 3 test fields (Action: Set Value, Fire on page load off, Selection Type: Item(s), Item(s): P2_TEST, P2_TEST2, P2_TEST3):
    select c001 from apex_collections where collection_name='FILTER'
    select c002 from apex_collections where collection_name='FILTER'
    select c003 from apex_collections where collection_name='FILTER'
    Only P2_TEST (corresponding to the value of P2_TABLE and c001) ever gets a value, the other two fields remain blank. I tried things like changing the order of the fields, but still only the value of P2_TABLE gets output.
    I'm not sure what I'm doing wrong here, any help is appreciated. Thanks!

    I found the problem -- in case it helps someone else, I just needed to add all three items to "Page Items to Submit" in the DA that calls add_member.

  • APEX_COLLECTION.UPDATE_MEMBER not Working

    Hi.
    I hope someone can help on this matter.
    I have been working with Apex for some time on and off and I and have accomplished more complicated stuff then this.
    Bit this has stopped me in my tracks for 2 days now.
    To the point.
    Onload I create a collection from where I populate a small classical report with a edit link redirecting to a URL(little javascript).
    All this does is show a hidden html region with a few text fields and populates it with the values from the selected row from the report.
    This is then edited and saved, but NOT submitted.
    The save button once again, redirects to a URL(Another small javascript) that passes the values to an On Demand Application process.
    Up to this point everything works fine.
    The process is executed and by different tests I know the values are being received.
    What is suppose to happen is the HTML region gets hidden again and the report refreshed from the collection again.
    That work perfectly BUT.
    For some reason, the APEX_COLLECTION.UPDATE_MEMBER just won't work and I have used this many times before.
    It also DOES NOT PRODUCE ANY ERROR.
    I subsequently broke the application in to a small test but it still won't work.
    The code follows.
    ---------------------------- THE CREATION OF THE COLLECTION ON PAGE LOAD ----------------------------
    DECLARE
      l_collection_name APEX_COLLECTIONS.COLLECTION_NAME%TYPE;
    BEGIN
      l_collection_name := 'TEST1';
      IF apex_collection.collection_exists(l_collection_name) THEN
        apex_collection.delete_collection(p_collection_name => l_collection_name);
      END IF;
      APEX_COLLECTION.CREATE_COLLECTION(p_collection_name => l_collection_name);
      FOR i IN (SELECT t_uid,  --c001 => f01
                       t_name,  --c002 => f02
                       t_name2,  --c003 => f03
                       'O' sts,  --c047 (for record status)
                       wwv_flow_item.md5(t_uid,
                                         t_name,
                                         t_name2) md  --c048 (for optimistic locking)
                        --c049 for (not used in collection/reserevered for seq_id array)
                        --c050 (not used in collection/reservered for delete checkbox array)
                FROM   t_test)
      LOOP
        APEX_COLLECTION.ADD_MEMBER(p_collection_name => l_collection_name,
                                                               p_c001            => i.t_uid,
                                                               p_c002            => i.t_name,
                                                               p_c003            => i.t_name2,
                                                               p_c047            => i.sts,
                                                               p_c048            => i.md);
      END LOOP;
    END;
    ---------------------------- JAVASCRIPT THAT SHOWS AND POPULATES THE HTML REGION  ----------------------------
    function popTest(tUid,tname,tName2,tSeq){
    $x_Show('T_DETAILS');
    $s("P5_T_UID",tUid);
    $s("P5_T_NAME",tname);
    $s("P5_T_NAME2",tName2);
    $s("P5_SEQ",tSeq);
    </script>
    ---------------------------- JAVASCRIPT THAT EXECUTES THE ON DEMAND PROCESS - HIDES THE HTML REGION - REFRESHES THE REPORT  ----------------------------
    function testJtoSQL(){
      var oDBGet = new htmldb_Get(null, $v('pFlowId'), "APPLICATION_PROCESS=MY_TEST", $v('pFlowStepId'));
      oDBGet.addParam('x01', $v('P5_SEQ'));
      oDBGet.addParam('x02', $v('P5_T_UID'));
      oDBGet.addParam('x03', $v('P5_T_NAME'));
      oDBGet.addParam('x04', $v('P5_T_NAME2'));
      var ajaxResult = oDBGet.get();
      $x_Hide('T_DETAILS');
      $("T_LIST").trigger("apexrefresh");
    ---------------------------- THE ON DEMAND PROCESS ----------------------------
    DECLARE
       l_collection_name APEX_COLLECTIONS.COLLECTION_NAME%TYPE;
    BEGIN
      l_collection_name := 'TEST1'
       -- This does not work --
       APEX_COLLECTION.UPDATE_MEMBER (
            p_collection_name => l_collection_name,
            p_seq => apex_application.g_x01,
            p_c001 => apex_application.g_x02,
            p_c002 => apex_application.g_x03,
            p_c003 => apex_application.g_x04);
      commit;
    END;
    I know there will be questions as to why I am doing it this way without submitting the page, so all I will say is that this is just part of a much bigger page with a lot more values to be set before submitting, validation, and processing.
    I really hope someone can help
    JJ

    Hi Peter.
    Firstly, thank you for your response.
    I have used APEX_DEBUG, with no results.
    To check if my values, I have changed the on demand process to actually update the table and not the UPDATE_MEMBER part,
    DECLARE
       l_collection_name APEX_COLLECTIONS.COLLECTION_NAME%TYPE;
    BEGIN
    /*  l_collection_name := 'TEST1'
        APEX_COLLECTION.UPDATE_MEMBER (
            p_collection_name => l_collection_name,
            p_seq => apex_application.g_x01,
            p_c001 => apex_application.g_x02,
            p_c002 => apex_application.g_x03,
            p_c003 => apex_application.g_x04);*/
      update t_test set t_name2 = apex_application.g_x01 || ' - ' || apex_application.g_x02 || ' - ' || apex_application.g_x03 || ' - ' || apex_application.g_x04;
      commit;
    END;
    It updates the table fine and I get my concatenated string in my second string column when checking the database.
    I went through it again and again.
    The APEX_COLLECTION.UPDATE_MEMBER call looks ok to me.
    Maybe I have been staring at it to long, but unless I am missing something, I really don't see anything wrong.
    Any ideas?

  • Apex_Collection Adding member via input from user

    Good day to all, I have this code how do I add member based on an input from a user via a textfield? I can just add one member only because when i select the collection it retrieves only one data, I want it to add more data based on the user if he enters 5 values I must retrieve 5 values also when I select it. How will I do that? thanks in advance.
    DECLARE
    v_arr apex_application_global.vc_arr2;
    BEGIN
    v_arr := apex_util.string_to_table(:P1_DEPTNO);
    apex_collection.create_or_truncate_collection(p_collection_name => 'PCOL');
    FOR i IN 1 .. v_arr.count
    LOOP
    apex_collection.add_member(p_collection_name => 'PCOL', p_c001 => v_arr(i));
    END LOOP;
    END;Edited by: mang jose on Jan 12, 2011 6:21 PM

    Hi Jose,
    There are only two steps needed. On my page, my page item is P4_DEPTNO (so adjust this for your page):
    1 - Create a process on your page that runs "On Load - Before Header". The process code should be:
    BEGIN
    IF NOT APEX_COLLECTION.COLLECTION_EXISTS('PCOL') THEN
      APEX_COLLECTION.CREATE_COLLECTION('PCOL');
    END IF;
    END;This creates the PCOL collection if it does not exist, otherwise does nothing if it does exist
    2 - Create another process on your page that runs "On Submit - After Computations and Validations". The code for this should be:
    BEGIN
    APEX_COLLECTION.ADD_MEMBER('PCOL', :P4_DEPTNO);
    END;I have set this process to be triggered by my button (P4_ADD_BUTTON in this example) but I have also set it to be conditional on P4_DEPTNO being NOT NULL - so, I have selected "Value of Item in Expression 1 is NOT NULL" and have entered P4_DEPTNO into Expression 1.
    And that is all you should need to do!
    Andy

  • Apex_collection.update_member.  What am I doing wrong.

    I am able to create my collection, then select from it. Unfortunately, I am not able to get it to update. I have been able to do this for other collections, so I am stumped...and believe it is something simple I am doing wrong....any thoughts? thank you.
    PROCESS: before header: create trip collection
    declare
    cursor fav is select trip_fav_seq
    from trip_favorites
    where cf_permit_id = :F200_PERMIT_ID and
    activate_flag = 'Y';
    xfav number;
    begin
    apex_collection.create_or_truncate_collection (p_collection_name => 'TRIP_C');
    open fav;
    fetch fav into xfav;
    if fav%found then
    apex_collection.add_member(p_collection_name => 'TRIP_C',
    p_c032 => :F200_fav_state , -- state
    p_c033 => :F200_fav_port, -- port
    p_c034 => :F200_FAV_VESSEL_ID, -- vessel id
    p_c035 => null, -- trip_start_date
    p_c036 => null, -- trip_start_time
    p_c037 => null, -- trip_end_date
    p_c038 => null, -- trip_end_time
    p_c039 => 'C', -- trip_type
    p_c040 => 'N', -- multiple_fishermen
    p_c041 => :F200_PERMIT_ID, -- cf_permit_id
    p_c042 => 0, -- days_at_sea
    p_c043 => 0, -- nbr_of_crew
    p_c044 => null, -- supplier_trip_id
    p_c045 => 1, -- trip_nbr
    p_c046 => null, -- partner_vtr
    p_c047 => :F200_PARTICIPANT_ID, -- submitted_by
    p_c048 => null, -- etrip_nbr
    p_c049 => :F200_PARTICIPANT_ID, -- ue,
    p_c050 => sysdate); -- de
    else
    apex_collection.add_member(p_collection_name => 'TRIP_C',
    p_c032 => null, -- state
    p_c033 => null, -- port
    p_c034 => null, -- vessel id
    p_c035 => null, -- trip_start_date
    p_c036 => null, -- trip_start_time
    p_c037 => null, -- trip_end_date
    p_c038 => null, -- trip_end_time
    p_c039 => 'C', -- trip_type
    p_c040 => 'N', -- multiple_fishermen
    p_c041 => :F200_PERMIT_ID, -- cf_permit_id
    p_c042 => 0, -- days_at_sea
    p_c043 => 0, -- nbr_of_crew
    p_c044 => null, -- supplier_trip_id
    p_c045 => 1, -- trip_nbr
    p_c046 => null, -- partner_vtr
    p_c047 => :F200_PARTICIPANT_ID, -- submitted_by
    p_c048 => null, -- etrip_nbr
    p_c049 => :F200_PARTICIPANT_ID, -- ue,
    p_c050 => sysdate); -- de
    end if;
    close fav;
    exception
    when no_data_found then
    null;
    end;
    QUERY:
    select apex_item.checkbox (30,seq_id,
    'onclick="highlight_row(this,' || seq_id ||')"',
    NULL,
    'f30_' || LPAD (seq_id, 4, '0')
    ) delete_checkbox,
    apex_item.hidden (31,seq_id)||
    apex_item.select_list_from_query(32,c032,'select partner_name d, state_code r
    from partners
    where state_code is not null
    order by partner_name',
    'style="width:100px;background-color:#FBEC5D; "'
    ||'onchange="f_set_casc_sel_list_item_port(this,f33_'||LPAD (seq_id, 4,'0')||')"',
    'YES',
    '0',
    '- Select State -',
    'f32_' || LPAD (seq_id,4, '0'),
    NULL,
    'NO'
    ) STATE,
    apex_item.select_list_from_query(33,c033,'select fips_place_name, port
    from valid_ports
    where fips_state = 0 order by fips_place_name',
    'style="width:150px"',
    'YES',
    '0',
    '- Select PORT -',
    'f33_' || LPAD (seq_id, 4, '0'),
    NULL,
    'NO' ) PORT,
    apex_item.POPUP_FROM_LOV(34,c034,'VESSELS',NULL,NULL,NULL,NULL,NULL,
    'style="width:100px;background-color:#FBEC5D; "') vessel_id,
    apex_item.text(35,c035) trip_start_date,
    apex_item.text(36,c036,5) trip_start_time,
    apex_item.text(37,c037) trip_end_date,
    apex_item.text(38,c038,5) trip_end_time,
    apex_item.SELECT_LIST_FROM_LOV(39,c039,'TRIP_TYPE','style="width:100px;background-color:#FBEC5D; "') trip_type,
    apex_item.SELECT_LIST_FROM_LOV(40,c040,'YES_NO',4) multiple_fishermen,
    apex_item.hidden(41,c041) cf_permit_id,
    apex_item.text(42,c042,3) days_at_sea,
    apex_item.text(43,c043,4) nbr_of_crew,
    apex_item.hidden(44,c044) supplier_trip_id,
    apex_item.hidden(45,c045) trip_nbr,
    apex_item.text(46,c046) partner_vtr,
    apex_item.hidden(47,c047) submitted_by,
    apex_item.text(48,c048,10) etrip_nbr,
    apex_item.hidden(49,c049) ue,
    apex_item.hidden(50,c050) de
    from apex_collections where collection_name = 'TRIP_C'
    PROCESS: AFTER SUBMIT : update_trip_collection
    declare
    xtrip number;
    begin
    select trips_seq.nextval into xtrip from dual;
    for x in 1..apex_application.g_f30.COUNT
    loop
    :P300_test:= 'in loop '||x;
    -- if it's an existing record
    IF apex_application.g_f30 (x) IS NOT NULL -- contains SEQ_ID
    THEN
    apex_collection.update_member (p_collection_name=> 'TRIP_C',
    p_seq => apex_application.g_f30(x),
    p_c031 => apex_application.g_f31(x),
    p_c032 => apex_application.g_f32(x),
    p_c033 => apex_application.g_f33(x),
    p_c034 => apex_application.g_f34(x),
    p_c035 => apex_application.g_f35(x),
    p_c036 => apex_application.g_f36(x),
    p_c037 => apex_application.g_f37(x),
    p_c038 => apex_application.g_f38(x),
    p_c039 => apex_application.g_f39(x),
    p_c040 => apex_application.g_f40(x),
    p_c041 => apex_application.g_f41(x),
    p_c042 => apex_application.g_f42(x),
    p_c043 => apex_application.g_f43(x),
    p_c044 => apex_application.g_f44(x),
    p_c045 => apex_application.g_f45(x),
    p_c046 => apex_application.g_f46(x),
    p_c047 => apex_application.g_f47(x),
    p_c048 => xtrip,
    p_c049 => apex_application.g_f49(x),
    p_c050 => apex_application.g_f50(x));
    else
    apex_collection.add_member (p_collection_name=> 'TRIP_C',
    p_c031 => apex_application.g_f31(x),
    p_c032 => apex_application.g_f32(x),
    p_c033 => apex_application.g_f33(x),
    p_c034 => apex_application.g_f34(x),
    p_c035 => apex_application.g_f35(x),
    p_c036 => apex_application.g_f36(x),
    p_c037 => apex_application.g_f37(x),
    p_c038 => apex_application.g_f38(x),
    p_c039 => apex_application.g_f39(x),
    p_c040 => apex_application.g_f40(x),
    p_c041 => apex_application.g_f41(x),
    p_c042 => apex_application.g_f42(x),
    p_c043 => apex_application.g_f43(x),
    p_c044 => apex_application.g_f44(x),
    p_c045 => apex_application.g_f45(x),
    p_c046 => apex_application.g_f46(x),
    p_c047 => apex_application.g_f47(x),
    p_c048 => xtrip,
    p_c049 => apex_application.g_f49(x),
    p_c050 => apex_application.g_f50(x));
    end if;
    end loop;
    end;

    and for the record, I have also tried: (error is 1403 no data found)
    declare
    xtrip number;
    c pls_integer := 0;
    begin
    --select trips_seq.nextval into xtrip from dual;
    for c1 in (select seq_id from apex_collections where collection_name = 'TRIP_C' order by seq_id)
    loop
    c := c+1;
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>1,p_attr_value=>wwv_flow.g_f32(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>2,p_attr_value=>wwv_flow.g_f33(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>3,p_attr_value=>wwv_flow.g_f34(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>4,p_attr_value=>wwv_flow.g_f35(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>5,p_attr_value=>wwv_flow.g_f36(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>6,p_attr_value=>wwv_flow.g_f37(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>7,p_attr_value=>wwv_flow.g_f38(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>8,p_attr_value=>wwv_flow.g_f39(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>9,p_attr_value=>wwv_flow.g_f40(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>10,p_attr_value=>wwv_flow.g_f41(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>11,p_attr_value=>wwv_flow.g_f42(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>12,p_attr_value=>wwv_flow.g_f43(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>13,p_attr_value=>wwv_flow.g_f44(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>14,p_attr_value=>wwv_flow.g_f45(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>15,p_attr_value=>wwv_flow.g_f46(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>16,p_attr_value=>wwv_flow.g_f47(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>17,p_attr_value=>wwv_flow.g_f48(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>18,p_attr_value=>wwv_flow.g_f49(c));
    apex_collection.update_member_attribute (p_collection_name=> 'TRIP_C',
    p_seq=> c1.seq_id,p_attr_number =>19,p_attr_value=>wwv_flow.g_f50(c));
    end loop;
    end;

  • APEX_COLLECTION and JDBC

    I want my APEX application to process a large amount of data (up to about 20,000 rows) obtained using a JDBC query. I cannot return a REF CURSOR since the database is remote and I cannot populate a global temporary table because its APEX.
    Is there a way to populate an APEX_COLLECTION from within my java code?
    ta

    Never mind. I worked it out:
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "SetApexCollection" AS
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.java.pool.*;
    public class SetApexCollection
    public static void doit() throws Exception
    Connection conn = (new OracleDriver()).defaultConnection();
    CallableStatement cstmt = null;
    try
    // Use a PL/SQL block to call APEX
    cstmt = conn.prepareCall
    ("begin" +
    " APEX_COLLECTION.ADD_MEMBER(" +
    " p_collection_name => ?," +
    " p_c001 => ?," +
    " p_c002 => ?," +
    " p_c003 => ?," +
    " p_c004 => ?," +
    " p_c005 => ?," +
    " p_c006 => ?," +
    " p_c007 => ?" +
    " ); " +
    " end;");
    cstmt.setString(1,"JDBCCOLLECTION") ;
    cstmt.setString(2,"A") ;
    cstmt.setString(3,"A") ;
    cstmt.setString(4,"A") ;
    cstmt.setString(5,"A") ;
    cstmt.setString(6,"A") ;
    cstmt.setString(7,"A") ;
    cstmt.setString(8,"A") ;
    cstmt.execute();
    finally
    conn.close();
    if (cstmt != null)
    cstmt.close();
    }

  • Problem: apex_collection.create_collection_from_query

    Hi;
    I've the following procedure:declare
        p_collection_name varchar2(1000) := 'EDIT_CAT';
    begin
            IF (apex_collection.collection_exists(p_collection_name))
            THEN
                apex_collection.delete_collection(p_collection_name);
            END IF;
            apex_collection.create_collection_from_query(
                p_collection_name => p_collection_name,
                p_query => 'select * from hd_category');      
    end;I alsways get the fllowing error:
    ORA-20104: create_collection_from_query Error:ORA-20104: create_collection_from_query ParseErr:ORA-00942: table or view does not exist
    But the table 'HD_CATEGORY' exists and setting up a normal select statement is working fine.
    Dows anybody know what's wrong with this?
    Thanks for any help
    chrissy

    Hi Scott,
    Sorry for my error in the first thread ... it's no procedure it's a process ...
    My code is, like you suggested, an anonymus block and it is an application process on demand.
    What I'm trying to do is to build the collection every time a record will be in edit.
    What I don't understand is, why I have to grant the SELECT privileg for the table. I can make a select on it, but not for the collection. Also my application schema user has the dba role, isn't there SELECT privilege included? I'm not firm in such things.
    At the moment I got it running, with a cursor and the normal apex_collection.create_collection and apex_collection.add_member.
    Thanks
    chrissy

  • Clearing a apex_collection

    Good day, I have this navigation list which contains "Skills and Identifications" and I have an apex_collection from query_b.
    When I click the Skills Navigation It must show all the skills in my apex_collection which I got it right. Now , my problem is when I click the Identification It will not show the Identification Information it will still show the skills information in my collection, It will not clear the collection. I tried using APEX_COLLECTION.DELETE_ALL_COLLECTIONS_SESSION it works but the problem with it I cannot add a member to my collection. How will I resolve this problem?

    On Load Before Header
    begin
    IF (APEX_COLLECTION.COLLECTION_EXISTS ('EMP_INFO_COLLECTION' ) THEN
      APEX_COLLECTION.DELETE_COLLECTION('<EMP_INFO_COLLECTION>' );
    END IF;
    APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY_B(
        p_collection_name => 'EMP_INFO_COLLECTION',
        p_query => q'!
          SELECT a.info_desc,a.info_value,a.date_transact FROM [email protected] a where a.emp_id =(SELECT v('P14_EMP_ID') FROM dual) and a.info_group = (select v('P14_GROUP_CODE') from dual) !');
    end;
    Process For adding a member
    begin
    APEX_COLLECTION.ADD_MEMBER('EMP_INFO_COLLECTION',:P14_INFO_DESC,:P14_INFO_VALUE, sysdate);
    end;
    Process For deleting a member
    BEGIN
    FOR x IN 1..APEX_APPLICATION.G_F01.COUNT
    LOOP
    APEX_COLLECTION.DELETE_MEMBER('EMP_INFO_COLLECTION', APEX_APPLICATION.G_F01(x));
    END LOOP;
    APEX_COLLECTION.RESEQUENCE_COLLECTION('EMP_INFO_COLLECTION');
    Reports Region
    select apex_item.checkbox (1,seq_id) "Delete",c001,c002,c003 FROM apex_collections where collection_name = 'EMP_INFO_COLLECTION'
    Navigation List Entry
    I have a Navigation List from a Query
    select a.group_name from [email protected] a where void_flg = 'Y'

  • Problem with accessing apex_collection data

    Hello,
    I got a problem with a apex_collection. I'm trying to fill this collection within a loop threw a database-cursor. It's part of a process (on load - before header). It looks like following:
    loop
        FETCH curs_1 INTO l_key;
        EXIT WHEN curs_1%NOTFOUND;
        select v.name, p.price
        into l_name, l_price
        from table_1 v, table_2 p
        where v.key = l_key
        and p.fkey = v.key;
        APEX_COLLECTION.ADD_MEMBER(p_collection_name => 'temp_collection',
                                       p_c001            => to_char(l_key),
                                       p_c002            => l_name,
                                       p_c003            => to_char(l_price));
       l_temp := l_temp||l_name||chr(10);
    end loop;As you can see I'm filling a temporary variable (l_temp). When I display this variable within an element it shows the correct values. But when i make a select on the collection there is no data found in the report. The report is at the same page as the process. Query for the report is:
    SELECT c001, c002
       FROM APEX_collections
    WHERE collection_name = 'temp_collection'I hope somebody can help.
    Thank you in advance
    Sebastian

    All collection names are allways UPPERCASE. If you use lowercase, it will not find it and no error message will be issued.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    ------------------------------------------------------------------------------

  • Problem with APEX_COLLECTION

    Hi,
    The following on-submit process is generating no_data_found on add_member procedure. I can't figure out why? Any ideas?
    IF NOT APEX_COLLECTION.collection_exists('SQL_QUERY_COLLECTION') THEN
    APEX_COLLECTION.create_collection('SQL_QUERY_COLLECTION');
    END IF;
    APEX_COLLECTION.DELETE_MEMBERS(
    p_collection_name => 'SQL_QUERY_COLLECTION',
    p_attr_number => 1,-- table name
    p_attr_value => UPPER(:P3_OLD_TABLE)
    FOR i IN 1..HTMLDB_APPLICATION.g_f03.COUNT LOOP
    IF APEX_COLLECTION.collection_exists('SQL_QUERY_COLLECTION') THEN
    APEX_COLLECTION.add_member(
    p_collection_name => 'SQL_QUERY_COLLECTION',
    p_c001 => UPPER(:P3_OLD_TABLE),
    p_c002 => HTMLDB_APPLICATION.g_f06(i),
    p_c003 => HTMLDB_APPLICATION.g_f03(i),
    p_c004 => HTMLDB_APPLICATION.g_f04(i),
    p_c005 => HTMLDB_APPLICATION.g_f05(i));
    END IF;
    END LOOP;

    Hi Arie,
    Thanks for your reply. I agree with your first comments, some of the guys on this forum are fantastic, it's great to have access to their advice! I never really understood what was going on with concatenating the hidden column, your explanation makes it a lot clearer. I tidied up my query as I think there were a few different things going on and my query became a little untidy. It's working well now.
    Thanks again,
    Donal.
    SELECT t.column_id, t.data_type, t.table_name as "Table Name", apex_item.hidden(1,t.table_name||t.column_name)||apex_item.checkbox(3,t.column_id, DECODE(c.c003, NULL, 'UNCHECKED','CHECKED')) as "Include", apex_item.display_and_save(2,t.column_name) as "Field Name", apex_item.select_list(4,NVL(c.c004, '='),'IN;IN,Like;Like,=;=,<;<,>;>,>=;>=,<=;<=,<>;<>') as "Logic", apex_item.text(5, c.c005 ) as "Criteria"
    FROM all_tab_columns@&DB_LINK_APP_ITEM. t, htmldb_collections c
    WHERE t.table_name = c.c001 (+)
    AND t.column_name = c.c002 (+)
    AND t.table_name = UPPER(:P3_TABLES)
    AND c.collection_name (+) = 'SQL_QUERY_COLLECTION'

  • Using apex_collection with apex_plsql_job

    Hi,
    Can anyone help with this?
    I'm building a CSV uploader app that uses apex_collections. A CSV file is uploaded to a blob column I then have a function that is successfully parsing the file and dropping the data into an Apex collection.
    This is working really well but I would like to extend it to handle really large CSV files without crashing the broswer. I would like to call my process using apex_plsql_job.
    I can't get this to work. The process runs but I can't see any data in my collection. It seems that because apex_collections are session specific, running the process of populating one via apex_plsql_job creates a collection in another session so I can't access it.
    So my question is; Is it possible to do one of the following?
    1. create an apex_collection and specifying the session I want to create it in - So I can pass in a session id to my call to apex_plsql_job
    OR
    2. call apex_plsq_job using a specific session so I can synchronise the collection that way.
    OR
    3. Querying an apex_collection specifying the session (presumably by querying the underlying tables and bypassing the apex_collections view)
    Any help appreciated.
    Cheers
    Yog

    Hi Denes,
    I have a follow up question. I hope you can help.
    I've not even managed to get as far as testing your session procedures. When I try to run the below procedure using the following on page call
    see procedure code at bottom
    BEGIN
    *:P1_JOB_ID := APEX_PLSQL_JOB.SUBMIT_PROCESS(*
    p_sql => 'BEGIN extract_file('||:P1_CSV_ID||', '||:APP_SESSION||', '||:APP_USER||', 104, 1); END;',
    p_status => 'Background process submitted');
    END;
    Nothing happens. Querying the apex_plsql_job view tells be that the job has completed.
    select * from APEX_PLSQL_JOBS where job = (select max(job) from apex_plsql_jobs)
    ID                          JOB FLOW_ID OWNER       ENDUSER   CREATED   MODIFIED STATUS                                SYSTEM_STATUS SYSTEM_MODIFIED SECURITY_GROUP_ID
    *2479017510194585 110 - KF_SYSTEM ANDERSON 07-APR-10 07-APR-10 Background process submitted COMPLETE 07-APR-10*
    *940410095919087*
    However, when If run select * from APEX_030200.WWV_FLOW_COLLECTIONS$ there is no collection called "LOADER" against any user
    even if the collection was not created I would have expected my test_log table to have been populated and it is empty.
    I have tried running apex_plsql_job using
    BEGIN
    *:P1_JOB_ID := APEX_PLSQL_JOB.SUBMIT_PROCESS(*
    p_sql => 'BEGIN insert into test_log(val) values (123); END;',
    p_status => 'Background process submitted');
    END;
    and it runs fine and populates my table.
    I've tried running grant execute on extract_file to public with no effect.
    I get the feeling I'm missing something really obvious here...
    Cheers
    Yog
    CREATE OR REPLACE procedure extract_file(p_csv_id IN NUMBER, p_session_id IN NUMBER, p_user IN VARCHAR2, p_app_id IN NUMBER, p_page IN NUMBER) as
    v_blob_data BLOB;
    v_blob_len NUMBER;
    v_position NUMBER;
    v_raw_chunk RAW(10000);
    v_char CHAR(1);
    v_chunk_len NUMBER := 1;
    v_line VARCHAR2 (32767) := NULL;
    v_data_array apex_application_global.vc_arr2;
    v_rows NUMBER;
    v_sr_no NUMBER := 1;
    v_script VARCHAR2(32767);
    v_error VARCHAR2(1000);
    BEGIN
    delete from test_log;
    insert into test_log(val) values ('p_csv_id = '||p_csv_id);
    insert into test_log(val) values ('p_session_id = '|| p_session_id);
    insert into test_log(val) values ('p_user = '||p_user);
    insert into test_log(val) values ('p_app_id = '||p_app_id);
    insert into test_log(val) values ('p_page = '||p_page );
    commit;
    HTMLDB_CUSTOM_AUTH.define_user_session (p_user, p_session_id);
    HTMLDB_APPLICATION.g_flow_id := p_app_id;
    HTMLDB_CUSTOM_AUTH.post_login (p_user,
    p_session_id,
    p_app_id || ':' || p_page
    apex_collection.create_or_truncate_collection( p_collection_name => 'LOADER' );
    SELECT csv_file
    INTO v_blob_data
    FROM test_csv
    WHERE csv_id = p_csv_id;
    v_blob_len := dbms_lob.getlength( v_blob_data );
    v_position := 1;
    WHILE ( v_position <= v_blob_len ) LOOP
    v_raw_chunk := dbms_lob.substr( v_blob_data, v_chunk_len, v_position );
    v_char := chr( fiche.hex_to_decimal( rawtohex( v_raw_chunk ) ) );
    v_line := v_line || v_char;
    v_position := v_position + v_chunk_len;
    IF v_char = chr(10) THEN
    v_line := replace( v_line, ':', '^' );
    v_line := replace( v_line, ',', ':' );
    v_data_array := apex_util.string_to_table( v_line );
    v_script := ' BEGIN
    apex_collection.add_member( p_collection_name => ''LOADER'' ';
    FOR i IN 1..v_data_array.COUNT LOOP
    v_script := v_script || '
    , p_c' ||lpad(i,3,0)|| ' => ''' || replace( replace( replace( to_char( v_data_array(i) ), '^', ':' ), chr(10),'' ), chr(13), '' ) ||'''';
    END LOOP;
    v_script := v_script ||' );
    END;
    execute immediate v_script;
    v_line := NULL;
    v_sr_no := v_sr_no + 1;
    END IF;
    END LOOP;
    exception when others then
    v_error := to_char(SQLERRM);
    insert into test_log(val) values (v_error);
    commit;
    END;
    Edited by: Yog on Apr 7, 2010 2:57 PM

  • Solved: apex_collections - what code goes into which place?

    I have been trying to get a simple example app to work, but seem to not understand something about apex_collections? Here is the basis of what I did and how it didn't work for me.
    Page 1
    Create a new process - new instance, after authentication - once per session or when reset
    begin
    apex_collection.create_or_truncate_collection(
    p_collection_name => 'TEST_KL'
    end;
    * Add Tab to naviation to page five. Initially start on page 1, then press the Page 5 tab
    Page 5
    Region 1
    contains Submit button
    page process - on submit - once per page visit
    begin
    apex_collection.add_member(
    p_collection_name => 'TEST_KL',
    p_c001 => 'Test',
    p_c002 => 'Test',
    p_c003 => 'Test',
    p_c004 => 'Test',
    p_c005 => 'Test'
    end;
    region 2
    report
    sql query
    select c001, c002, c003, c004, c005
    from apex_collections
    where collection_name = 'TEST_KL'
    Left the report attributes to default values - c001 displays as c001.
    Run the application.
    I get the submit button, and the display region for the report with no data found.
    Press the submit button.
    no change
    Press the submit button again.
    no change - still see no data found in report region.
    I don't get it? What am I doing wrong here?
    Thanks, Ken

    Ken,
    After you have submitted and moved to tab 5, have a look in the database tables:
    flows_030000.wwv_flow_collections$
    flows_030000.wwv_flow_collection_members$.
    In the first table you should see a record that has collection_name = <your collection name>. Take the ID column value and look in the second table. There will be 1 record for each add_member process that tab1 processing performs.
    If you can't find any, then the problem lies in the tab 1 processing. If the records do exist then the problem is in the tab 5 process.
    Hope this helps
    Bryan.

  • Capture Web Cam image in APEX and Upload into the Database

    Overview
    By using a flash object, you should be able to interface with a usb web cam connected to the client machine. Their are a couple of open source ones that I know about, but the one I chose to go with is by Taboca Labs and is called CamCanvas. This is released under the MIT license, and it is at version 0.2, so not very mature - but in saying that it seems to do the trick. The next part is to upload a snapshot into the database - in this particular implementation, it is achieved by taking a snapshot, and putting that data into the canvas object. This is a new HTML5 element, so I am not certain what the IE support would be like. Once you have the image into the canvas, you can then use the provided function convertToDataURL() to convert the image into a Base64 encoded string, which you can then use to convert into to a BLOB. There is however one problem with the Base64 string - APEX has a limitation of 32k for and item value, so can't be submitted by normal means, and a workaround (AJAX) has to be implemented.
    Part 1. Capturing the Image from the Flash Object into the Canvas element
    Set up the Page
    Required Files
    Download the tarball of the webcam library from: https://github.com/taboca/CamCanvas-API-/tarball/master
    Upload the necessary components to your application. (The flash swf file can be got from one of the samples in the Samples folder. In the root of the tarball, there is actually a swf file, but this seems to be a different file than of what is in the samples - so I just stick with the one from the samples)
    Page Body
    Create a HTML region, and add the following:
        <div class="container">
           <object  id="iembedflash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="320" height="240">
                <param name="movie" value="#APP_IMAGES#camcanvas.swf" />
                <param name="quality" value="high" />
              <param name="allowScriptAccess" value="always" />
                <embed  allowScriptAccess="always"  id="embedflash" src="#APP_IMAGES#camcanvas.swf" quality="high" width="320" height="240"
    type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" mayscript="true"  />
        </object>
        </div>
    <p><a href="javascript:captureToCanvas()">Capture</a></p>
    <canvas style="border:1px solid yellow"  id="canvas" width="320" height="240"></canvas>That will create the webcam container, and an empty canvas element for the captured image to go into.
    Also, have a hidden unprotected page item to store the Base64 code into - I called mine P2_IMAGE_BASE64
    HTML Header and Body Attribute
    Add the Page HTML Body Attribute as:
    onload="init(320,240)"
    JavaScript
    Add the following in the Function and Global Variable Declarations for the page (mostly taken out of the samples provided)
    //Camera relations functions
    var gCtx = null;
    var gCanvas = null;
    var imageData = null;
    var ii=0;
    var jj=0;
    var c=0;
    function init(ww,hh){
         gCanvas = document.getElementById("canvas");
         var w = ww;
         var h = hh;
         gCanvas.style.width = w + "px";
         gCanvas.style.height = h + "px";
         gCanvas.width = w;
         gCanvas.height = h;
         gCtx = gCanvas.getContext("2d");
         gCtx.clearRect(0, 0, w, h);
         imageData = gCtx.getImageData( 0,0,320,240);
    function passLine(stringPixels) {
         //a = (intVal >> 24) & 0xff;
         var coll = stringPixels.split("-");
         for(var i=0;i<320;i++) {
              var intVal = parseInt(coll);
              r = (intVal >> 16) & 0xff;
              g = (intVal >> 8) & 0xff;
              b = (intVal ) & 0xff;
              imageData.data[c+0]=r;
              imageData.data[c+1]=g;
              imageData.data[c+2]=b;
              imageData.data[c+3]=255;
              c+=4;
         if(c>=320*240*4) {
              c=0;
              gCtx.putImageData(imageData, 0,0);
    function captureToCanvas() {
         flash = document.getElementById("embedflash");
         flash.ccCapture();
         var canvEle = document.getElementById('canvas');
         $s('P2_IMAGE_BASE64', canvEle.toDataURL());//Assumes hidden item name is P2_IMAGE_BASE64
         clob_Submit();//this is a part of part (AJAX submit value to a collection) two
    }In the footer region of the page (which is just a loading image to show whilst the data is being submitted to the collection [hidden by default]) :<img src="#IMAGE_PREFIX#processing3.gif" id="AjaxLoading"
    style="display:none;position:absolute;left:45%;top:45%;padding:10px;border:2px solid black;background:#FFF;" />If you give it a quick test, you should be able to see the webcam feed and capture it into the canvas element by clicking the capture link, in between the two elements - it might through a JS error since the clob_Submit() function does not exist yet.
    *Part 2. Upload the image into the Database*
    As mentioned in the overview, the main limitation is that APEX can't submit values larger than 32k, which I hope the APEX development team will be fixing this limitation in a future release, the workaround isn't really good from a maintainability perspective.
    In the sample applications, there is one that demonstrates saving values to the database that are over 32k, which uses an AJAX technique: see http://www.oracle.com/technetwork/developer-tools/apex/application-express/packaged-apps-090453.html#LARGE.
    *Required Files*
    From the sample application, there is a script you need to upload, and reference in your page. So you can either install the sample application I linked to, or grab the script from the demonstration I have provided - its called apex_save_large.js.
    *Create a New Page*
    Create a page to Post the large value to (I created mine as 1000), and create the following process, with the condition that Request = SAVE. (All this is in the sample application for saving large values).declare
         l_code clob := empty_clob;
    begin
         dbms_lob.createtemporary( l_code, false, dbms_lob.SESSION );
         for i in 1..wwv_flow.g_f01.count loop
              dbms_lob.writeappend(l_code,length(wwv_flow.g_f01(i)),wwv_flow.g_f01(i));
         end loop;
         apex_collection.create_or_truncate_collection(p_collection_name => wc_pkg_globals.g_base64_collection);
         apex_collection.add_member(p_collection_name => wc_pkg_globals.g_base64_collection,p_clob001 => l_code);
         htmldb_application.g_unrecoverable_error := TRUE;
    end;I also created a package for storing the collection name, which is referred to in the process, for the collection name:create or replace
    package
    wc_pkg_globals
    as
    g_base64_collection constant varchar2(40) := 'BASE64_IMAGE';
    end wc_pkg_globals;That is all that needs to be done for page 1000. You don't use this for anything else, *so go back to edit the camera page*.
    *Modify the Function and Global Variable Declarations* (to be able to submit large values.)
    The below again assumes the item that you want to submit has an item name of 'P2_IMAGE_BASE64', the condition of the process on the POST page is request = SAVE, and the post page is page 1000. This has been taken srtaight from the sample application for saving large values.//32K Limit workaround functions
    function clob_Submit(){
              $x_Show('AjaxLoading')
              $a_PostClob('P2_IMAGE_BASE64','SAVE','1000',clob_SubmitReturn);
    function clob_SubmitReturn(){
              if(p.readyState == 4){
                             $x_Hide('AjaxLoading');
                             $x('P2_IMAGE_BASE64').value = '';
              }else{return false;}
    function doSubmit(r){
    $x('P2_IMAGE_BASE64').value = ''
         flowSelectAll();
         document.wwv_flow.p_request.value = r;
         document.wwv_flow.submit();
    }Also, reference the script that the above code makes use of, in the page header<script type="text/javascript" src="#WORKSPACE_IMAGES#apex_save_large.js"></script>Assuming the script is located in workspace images, and not associated to a specific app. Other wise reference #APP_IMAGES#
    *Set up the table to store the images*CREATE TABLE "WC_SNAPSHOT"
    "WC_SNAPSHOT_ID" NUMBER NOT NULL ENABLE,
    "BINARY" BLOB,
    CONSTRAINT "WC_SNAPSHOT_PK" PRIMARY KEY ("WC_SNAPSHOT_ID")
    create sequence seq_wc_snapshot start with 1 increment by 1;
    CREATE OR REPLACE TRIGGER "BI_WC_SNAPSHOT" BEFORE
    INSERT ON WC_SNAPSHOT FOR EACH ROW BEGIN
    SELECT seq_wc_snapshot.nextval INTO :NEW.wc_snapshot_id FROM dual;
    END;
    Then finally, create a page process to save the image:declare
    v_image_input CLOB;
    v_image_output BLOB;
    v_buffer NUMBER := 64;
    v_start_index NUMBER := 1;
    v_raw_temp raw(64);
    begin
    --discard the bit of the string we dont need
    select substr(clob001, instr(clob001, ',')+1, length(clob001)) into v_image_input
    from apex_collections
    where collection_name = wc_pkg_globals.g_base64_collection;
    dbms_lob.createtemporary(v_image_output, true);
    for i in 1..ceil(dbms_lob.getlength(v_image_input)/v_buffer) loop
    v_raw_temp := utl_encode.base64_decode(utl_raw.cast_to_raw(dbms_lob.substr(v_image_input, v_buffer, v_start_index)));
    dbms_lob.writeappend(v_image_output, utl_raw.length(v_raw_temp),v_raw_temp);
    v_start_index := v_start_index + v_buffer;
    end loop;
    insert into WC_SNAPSHOT (binary) values (v_image_output); commit;
    end;Create a save button - add some sort of validation to make sure the hidden item has a value (i.e. image has been captured). Make the above conditional for request = button name so it only runs when you click Save (you probably want to disable this button until the data has been completely submitted to the collection - I haven't done this in the demonstration).
    Voila, you should have now be able to capture the image from a webcam. Take a look at the samples from the CamCanvas API for extra effects if you wanted to do something special.
    And of course, all the above assumed you want a resolution of 320 x 240 for the image.
    Disclaimer: At time of writing, this worked with a logitech something or rather webcam, and is completely untested on IE.
    Check out a demo: http://apex.oracle.com/pls/apex/f?p=trents_demos:webcam_i (my image is a bit blocky, but i think its just my webcam. I've seen others that are much more crisp using this) Also, just be sure to wait for the progress bar to dissappear before clicking Save.
    Feedback welcomed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hmm, maybe for some reason you aren't getting the base64 version of the saved image? Is the collection getting the full base64 string? Seems like its not getting any if its no data found.
    The javascript console is your friend.
    Also, in the example i used an extra page, from what one of the examples on apex packages apps had. But since then, I found this post by Carl: http://carlback.blogspot.com/2008/04/new-stuff-4-over-head-with-clob.html - I would use this technique for submitting the clob, over what I have done - as its less hacky. Just sayin.

  • Apex_application.g_fXX and collection problem

    Hello all!
    In the midst of writing my second apex application, it appears I need to use apex_application functionality to meet my requirements and am seeking assistance.
    I have a table/report with a column link (item_id) and a second column (as a text field) (there are more columns displayed), but I think they are irrelevant to this situation) populated with a value QTY (c002) from a collection where c001 = item_id. What I'm attempting to do is allow someone to enter a qty in the c002 text field, apply the qty change to the collection and reload the page displaying the new quantity value in the report when the column link (image) is selected (page redirects to itself).
    Since it appears that column links are not a SUBMIT, I've put my collection update plsql in a before header process. According to the debug output, this collection insert is executed long before the rendering of the report.
    This is my report plsql;
    declare
    l_query varchar2(4000) := '';
    begin
    l_query := 'select i.INVENTORY_ID, col.c002, ql.QUANTITY_AVAILABLE, i.STRAIN_CODE, i.STRAIN_NAME, i.GENOTYPE, i.AGE, i.SEX, ql.ROOM_NUMBER from SM_INVENTORY i, SM_QUANTITY_LOCATION ql, apex_collections col where ql.STRAIN_ID = i.STRAIN_ID(+) and col.collection_name (+)= ''ORDER'' and col.c001 (+)= i.INVENTORY_ID';
    end;
    This is my update collection plsql (I don't have the insert part yet, but my collection already contains values);
    declare col_item_count number;
    col_seq number;
    item_id number;
    qty number;
    begin
    if apex_collection.collection_exists('ORDER') = FALSE then
    apex_collection.create_collection( p_collection_name => 'ORDER');
    commit;
    end if;
    for i in 1..apex_application.g_f01.count
    loop
    item_id := apex_application.g_f01(i);
    qty := apex_application.g_f02(i);
    select count(c001),seq_id into col_item_count, col_seq
    from apex_collections
    where c001 = item_id
    and collection_name = 'ORDER';
    group by c001, seq_id;
    if col_item_count > 0 then
    apex_collection.update_member(
    p_collection_name => 'ORDER',
    p_seq             => col_seq,
    p_c001 => item_id,
    p_c002 => qty);
    commit;
    end if;
    end loop;
    end;
    Given all this, my collection entry is not updated with the new value of c002 displayed in my report text field.
    Be advised, I've not found documentation about the apex_application package of sufficient detail to allow me to comprehend exactly what gets put into the apex_application.g_fXX values or when, but based on what I've gathered from examples/blogs, I think it contains the report in the currently rendered page, but I honestly don't know.
    Given my assumptions, I'm expecting apex_application.g_f01(1) would be the first row item_id of my report and apex_application.g_f01(2) would be the first row c002 (qty from my collection) of my report. If this is correct, I would expect this would work.
    What might I have missed?
    Thanks!
    Paul
    PS. Honestly, is this methodology the only/easiest way to get my requirement/functionality to work? Is there an easier way?

    OK, tried this - not yet successful. This is what I've got.
    Classic report loaded by;
    declare
    l_query varchar2(4000) := '';
    begin
    l_query := 'select i.INVENTORY_ID, i.INVENTORY_ID inv_id_hold, col.c002, ql.QUANTITY_AVAILABLE, i.STRAIN_CODE, i.STRAIN_NAME, i.GENOTYPE, i.AGE, i.SEX, ql.ROOM_NUMBER from SM_INVENTORY i, SM_QUANTITY_LOCATION ql, apex_collections col where ql.STRAIN_ID = i.STRAIN_ID(+) and col.collection_name (+)= ''ORDER'' and col.c001 (+)= i.INVENTORY_ID';
    end;
    Created a "SAVE" button.
    Set up column inv_id_hold as a hidden tab form element and col.c002 as a text field tab form element (item_id and qty respectively). These should now be available as apex_application.g_f01 and apex_application.g_f02 (right?).
    I have this post submit plsql in a process conditioned to the "SAVE" button.
    declare col_item_count number;
    col_seq number;
    item_id number;
    qty number;
    begin
    if apex_collection.collection_exists('ORDER') = FALSE then
    apex_collection.create_collection( p_collection_name => 'ORDER');
    end if;
    for i in 1..apex_application.g_f01.count
    loop
    item_id := apex_application.g_f01(i);
    qty := apex_application.g_f02(i);
    select count(c001),seq_id into col_item_count, col_seq
    from apex_collections
    where c001 = apex_application.g_f01(i)
    and collection_name = 'ORDER';
    --group by c001, seq_id;*
    if col_item_count > 0 then
    apex_collection.update_member(
    p_collection_name => 'ORDER',
    p_seq             => col_seq,
    p_c001 => item_id,
    p_c002 => qty);
    else
    apex_collection.add_member(
    p_collection_name => 'ORDER',
    p_c001 => item_id,
    p_c002 => qty);
    end if;
    end loop;
    end;
    When I enter something in my qty column and press SAVE, I get "ORA-01403: no data found" being thrown by the plsql process (per debug). Since everything is going on "under the hood" and there is no step debugger in apex, I'm not able to see/understand the process in action and determine where the problem is occurring.
    I got the idea for all of this here - http://apex.oracle.com/pls/otn/f?p=39839:3:5596350954563087::NO which is the shopping cart page of the online store application. But I'm trying to get the quantity edit portion to work on the inventory listing (so a customer can add items to an order simply by providing qty input for a particular line item(s) and saving).
    Any advice?
    Can you write an order processing system in apex that uses a collection to store line items?

Maybe you are looking for

  • Photo gallery limited to 5 pages?

    I have over 200 photos for some of my galleries. I would prefer to keep around 20 or so photos per page, but it seems iWeb limits the number of pages to 5, and it wont display the remaining photos. Is there a setting somewhere that tells it to limit

  • How to Validate XML against XSD through PL/SQL?

    Hi friends, I m new to this forum. This is my first query. In our project, we are trying to generate output XML using PL/SQL procedure. I have done that successfully. Now my problem is I have to validate this against our XSD. How will I do that? Can

  • TS3899 iPhone OS 7 issues re. Mail.  Need Help

    I just updated my iPhone to the OS 7 and for some reason my email is showing that I have 6000+ emails when my old phone only showed the most recent 50 or so.  How can I change this so I'm not showing thousands of unread emails?

  • Aperture 3 and Facebook

    Hi, I love the idea of uploading direct from Aperture however I'm worried about what happens if I had to reinstall Aperture or I bought a new Mac etc, would the album be deleted form the Facebook site? I know this happens in iPhoto as far as I'm awar

  • Transit Time in Calendar Days?

    Hello, For quite a long time, I thought in transportation and delivery scheduling the TRANSIT TIME is measured in Calendar Days, which means weekends and public holidays are also included. For example, if the delivery date is 2007-12-31, and transit