Checkbox Selections into a Collection

I have been tossing this around for a while now and can’t seem to come up with a solution from examples and docs. I know I'm missing something, but I don't know what. I am hoping one of you can shed some light on what I missing to get me back on track or on a new track if this one is wrong.
I am trying to select multiple records in a report then go to a second page to add a single status and comment for the group of selected records. The status, comment, and some of the original report data (like primary key) will be merged into a secondary table once I get the collection working. I would do this all on one page but I also have a number of criteria selections on the first page that I think would become too busy if I also added the status and comment fields.
In order to create this report, I think I need to use a collection to hold the selected records. I can get the PK and associated fields from a simple SQL report into a collection but I can only get the PK from PL/SQL. I can use the PK to pull the data from the database again but I hate the thought of hitting the database again for data I have on the screen. I am using PL/SQL to allow the WHERE clause to dynamically change based upon the criteria selected.
For the collection, I am using the method from Joel Kallman’s blog (http://joelkallman.blogspot.com/2008/03/preserving-checked-checkboxes-in-report.html) to preserve the rows as they are selected. It works great for the item listed in the apex_item.checkbox item but I can’t find an answer to how to also bring some of the other fields from the report into the collection.
I have posted a simplified example on OTN for your review/comments. It does not contain the criteria mentioned above to eliminate complexity from the example. I am using APEX version 3.2.0.00.27.
Workspace: bobs
Username: guest
Password: abc123
Application: Multi Select Edit – 60803
Page 1 will give you a menu to select the SQL or PL/SQL version of the pages.
I would also love to be able to have the multi select working at the heading of the checkboxes in the PL/SQL report but I can’t get it to work properly. The boxes will all show as checked but the data doesn't get put into the collection unless the checkbox for each row is individually selected. This feature is not in the example since it is a lower priority.
The basics of the example PL/SQL report are as follows._
The report source is:
DECLARE
q VARCHAR2(32767); -- query
BEGIN
q := 'select apex_item.checkbox(1, empno, ''onclick="f_UpdateCollection(this)"'',a.c001) cbox, '||
' "EMPNO", '||
' "ENAME", '||
' "JOB", '||
' "MGR", '||
' "SAL", '||
' "DEPTNO" '||
' from "EMP", apex_collections a '||
' where '||
' a.c001 (+)= empno '||
' and a.collection_name (+)= ''EMP_COLLECTION'' ';
RETURN q;
END;
The HTML Header for the page contains the function that is called from the onclick statement.
<script type="text/javascript">
<!--
function f_UpdateCollection( cb ){
var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=UpdateCheckboxValue',0);
get.addParam('x01',cb.value);
get.GetAsync(function(){return;});
get = null;
//-->
</script>
And the Application Process that populates the collection is:
declare
l_value varchar2(4000);
l_seq_id number := 0;
l_collection_name constant varchar2(30) := 'EMP_COLLECTION';
begin
-- Get the value of the global which will be set in JavaScript
l_value := wwv_flow.g_x01;
-- If our collection named EMP_COLLECTION doesn't exist yet, create it
if apex_collection.collection_exists( l_collection_name ) = FALSE then
apex_collection.create_collection( p_collection_name => l_collection_name );
end if;
-- See if the specified value is already present in the collection
for c1 in (select seq_id
from apex_collections
where collection_name = l_collection_name
and c001 = l_value) loop
l_seq_id := c1.seq_id;
exit;
end loop;
-- If the current value was not found in the collection, add it. Otherwise, delete it from the collection.
if l_seq_id = 0 then
apex_collection.add_member(
p_collection_name => l_collection_name,
p_c001 => l_value );
else
apex_collection.delete_member(
p_collection_name => l_collection_name,
p_seq => l_seq_id );
end if;
commit;
end;
The final report is a simple select from the collection.
select *
from apex_collections
where collection_name = 'EMP_COLLECTION'
Thank you for your time.
Bob

Jeff,
Thanks for the response. I had tried the apex_item before but I couldn't get it to work. I have changed the SQL to include the apex_item commands then used them to define parameters in the javascript function then added parameters to the Application Process but I get no data found. Am I using the apex_item wrong in the SQL or the apex_application wrong in the javascript?
Thanks,
Bob
SQL:_
q := 'select apex_item.checkbox(1, empno||''~''||ename||''~''||job||''~''||hiredate, ''onclick="f_UpdateCollection(this)"'',a.c001) cbox, '||
' apex_item.display_and_save(2,empno) "EMPNO", '||
' apex_item.display_and_save(3,ename) "ENAME", '||
Javascript:_
function f_UpdateCollection( cb ){
var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=UpdateCheckboxValue',0);
get.addParam('x01',cb.value);
get.addParam('x02',apex_application.g_f02);
get.addParam('x03',apex_application.g_f03);
get.GetAsync(function(){return;});
get = null;
Application Process:_
declare
l_value varchar2(4000);
l_empno  varchar2(4000);
l_ename  varchar2(4000);
begin
l_value := wwv_flow.g_x01;
l_empno := wwv_flow.g_x02;
l_ename := wwv_flow.g_x03;
apex_collection.add_member(
p_collection_name => l_collection_name,
p_c005            => l_empno,
p_c006            => l_ename,
p_c010 => l_value );
...

Similar Messages

  • Select into OBJECT TYPE

    Gotta run this some folks as it is driving me nuts. Using the nested table types so I have a simple type declared as this....
    CREATE OR REPLACE
    TYPE MAGIC_ARRAY AS TABLE OF FLOAT;
    I want to use a function which gets the values in the table by column attempts to select into the collection......
    FUNCTION getMagicNumbers()
    RETURN magic_array
    IS
    v_magic_array magic_array := magic_array();
    BEGIN
    v_magic_array.extend(10);
    select cbe.Field1,
    cbe.Field2,
    cbe.Field3,
    cbe.Field4,
    cbe.Field5,
    cbe.Field6,
    cbe.Field7,
    cbe.Field8,
    cbe.Field9,
    cbe.Field10
    INTO v_magic_array
    from cbe_magic_number cbe
    WHERE ROWNUM=1;
    --Return the value
    return (v_magic_array);
    end getMagicNumbers;
    Looks like it should work but I get ORA-00947: not enough values. If I replace the "INTO v_magic_array" with individual indexed values....
    INTO v_magic_array(1),
    v_magic_array(2),
    v_magic_array(3),
    v_magic_array(4),
    v_magic_array(5),
    v_magic_array(6),
    v_magic_array(7),
    v_magic_array(8),
    v_magic_array(9),
    v_magic_array(10),
    It compiles and works fine. Do I need to use the indexes for the assignment of values all the time?

    you need to specifically list the elements by subscript.It seems simpler to just instantiate a new collection in-line in your SQL.
    SQL> SET SERVEROUTPUT ON;
    SQL> DECLARE
      2     FUNCTION getmagicnumbers
      3        RETURN magic_array
      4     IS
      5        v_magic_array magic_array;
      6     BEGIN
      7        SELECT magic_array (
      8                  cbe.field1, cbe.field2,
      9                  cbe.field3, cbe.field4,
    10                  cbe.field5, cbe.field6,
    11                  cbe.field7, cbe.field8,
    12                  cbe.field9, cbe.field10)
    13        INTO   v_magic_array
    14        FROM   cbe_magic_number cbe
    15        WHERE  ROWNUM = 1;
    16 
    17        RETURN v_magic_array;
    18     END;
    19  BEGIN
    20     DBMS_OUTPUT.PUT_LINE (
    21        'getmagicnumbers ().COUNT => ' ||
    22           getmagicnumbers ().COUNT);
    23  END;
    24  /
    getmagicnumbers ().COUNT => 10
    PL/SQL procedure successfully completed.
    SQL>

  • Creating a collection from a query in Apex 4.2 is not populating the data into the collection.

    I have a process that creates a collection with data from multiple tables. The query returns multiple rows in 'Sql commands' tab. The same query is used to create the collection in 'Before Header' and when i create a region with Region source as
    Select * From apex_collections Where collection_name = 'load_dashboard';
    At the time of rendering the page shows me 'no data found'.
    what could be the problem? Are there any prerequisites before creating the collection?
    Thanks in Advance,
    Sriram

    Hi Denes,
    Below is my code for creating and saving data into the collection.
    if apex_collection.collection_exists(p_collection_name =>'load_dashboard') then
       apex_collection.delete_collection(
             p_collection_name =>'load_dashboard');
    end if;
    apex_collection.create_collection_from_query(
        p_collection_name => 'load_dashboard',
        p_query => 'select a.rowid
                   ,b.first_name
                   ,b.last_name
                   ,c.job_title
                   ,d.parent
                   ,d.child_level_1
                   ,d.child_level_2
                   ,a.resource_allocation
                   ,a.person_id
                   ,a.month_id
                   ,a.oracom_project_id    ,wwv_flow_item.md5(a.rowid,b.first_name,b.last_name,c.job_title,d.parent,d.child_level_1,d.child_level_2,a.resource_allocation,a.person_id,a.month_id,a.oracom_project_id)
    from oracom_resource_management a, oracom_people b,oracom_job c ,oracom_project d where a.supervisor_id=886302415 and a.month_id=201312 and a.oracom_job_id=c.job_id and a.person_id=b.person_id and a.oracom_project_id=d.oracom_project_id',
       p_generate_md5 => 'YES'
    Sriram.

  • Inserting Data into a Collection

    Hi
    Can anybody suggest how to Insert data into a Collection from another Collection Using Bulk Binds in PLSQL?
    My scenario :-
    CREATE OR REPLACE PACKAGE te_ar IS
    TYPE srm_rec IS RECORD (col1 <table>.<col1>%TYPE, col2 <table>.<col2>%TYPE);
    TYPE srm_rec_list IS TABLE OF srm_rec INDEX BY BINARY_INTEGER;
    FUNCTION z_srm_rec RETURN srm_rec_list PIPELINED;
    END te_ar;
    CREATE OR REPLACE PACKAGE BODY te_ar IS
    FUNCTION z_srm_rec RETURN srm_rec_list PIPELINED IS
    v_srm_rec srm_rec;
    TYPE col1_t IS TABLE OF <table>.<col1>%TYPE INDEX BY BINARY_INTEGER;
    TYPE col2_t IS TABLE OF <table>.<col2>%TYPE INDEX BY BINARY_INTEGER;
    col1_tt col1_t;
    col2_tt col2_t;
    CURSOR c1
    IS
    SELECT col1, col2 FROM table;
    BEGIN
    OPEN c1;
    FETCH c1 BULK COLLECT INTO col1_tt,col2_tt;
    FORALL i IN 1 .. c1%ROWCOUNT
    v_srm_rec.col1(i) := col1_tt(i);
    v_srm_rec.col2(i) := col2_tt(i);
    PIPE_ROW(v_srm_rec);
    CLOSE c1;
    RETURN;
    END;
    END te_ar;
    I have created a Record Type in which I am trying to insert rows using bulk bind and return it using a pipelined function.
    This approach is throwing me errors in which I am unable to use both Pipelining and Bulk Binds together so that I can make the Performance of the entire bit better.
    Please suggest the way forward.
    Any other relevant info I am ready to supply.
    Thanks
    Arnab

    FORALL is used for bulk DML statements and will not work for your collections. http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/forall_statement.htm#LNPLS01321. I think you may want to use a regular FOR loop.

  • Cannot SELECT into a user-defined type variable

    Hi All,
    Oracle 11.2 on Linux.
    See the steps below. I am not able to insert/select into a TYPE variable. I do not want to do a TABLE declaration in my PL/SQL block, but want to use a user defined type. Is it possible ?
    SQL> create or replace type sample_obj_rec as object
      2  (
      3     object_id    number,
      4     object_name  varchar2(32),
      5     object_type  varchar2(32)
      6  );
      7  /
    Type created.
    SQL> create or replace type sample_obj_tab as table of sample_obj_rec ;
      2  /
    Type created.
    -- ------------   CASE 1 ---------------------
    SQL> declare
      2      v_tab   sample_obj_tab := sample_obj_tab() ;
      3  begin
      4      select object_id, object_name, object_type
      5      bulk   collect into v_tab
      6      from   dba_objects
      7      where  rownum < 11 ;
      8  end ;
      9  /
        from   dba_objects
    ERROR at line 6:
    ORA-06550: line 6, column 5:
    PL/SQL: ORA-00947: not enough values
    ORA-06550: line 4, column 5:
    PL/SQL: SQL Statement ignored
    -- ------------   CASE 2 ---------------------
    SQL> declare
      2      v_rec   sample_obj_rec;
      3  begin
      4      select object_id, object_name, object_type
      5      into   v_rec
      6      from   dba_objects
      7      where  rownum = 1;
      8  end ;
      9  /
        from   dba_objects
    ERROR at line 6:
    ORA-06550: line 6, column 5:
    PL/SQL: ORA-00947: not enough values
    ORA-06550: line 4, column 5:
    PL/SQL: SQL Statement ignoredWhat is the issue with both the above cases? what am I missing here?
    Thanks in advance.

    One small detail in the SELECT.
    SQL> create or replace type sample_obj_rec as object
      2  (object_id    number,
      3   object_name  varchar2(32),
      4   object_type  varchar2(32));
      5  /
    Type created.
    SQL>
    SQL> create or replace type sample_obj_tab as table of sample_obj_rec ;
      2  /
    Type created.
    SQL>
    SQL> declare
      2     v_tab   sample_obj_tab := sample_obj_tab() ;
      3  begin
      4     select sample_obj_rec(object_id, object_name, object_type)
      5     bulk   collect into v_tab
      6     from   dba_objects
      7     where  rownum < 11 ;
      8  end ;
      9  /
    PL/SQL procedure successfully completed.
    SQL>

  • Select from a collection of collections SELECT - CAST - MULTISET - TABLE

    Does someone have a suggestion for the SELECT statement which is performing a CAST?
    I am on Oracle 10.2.0.1.0. The goal is to take a collection of a nested table and order it by color, then descr, then grown_by, saving it into an ordered collection (v_List2). Am getting error with ORA-22907 Invalid cast to a type that is not a nested table.
    CREATE OR REPLACE TYPE     ot_fruit
    AS OBJECT
        descr            VARCHAR2(100)
       ,color          VARCHAR2(50)
       ,grown_by          VARCHAR2(50) 
    CREATE OR REPLACE TYPE tab_fruitList AS TABLE OF ot_fruit;
    CREATE OR REPLACE TYPE     ot_tab_fruit
    AS OBJECT
        fruit            tab_fruitList
    DECLARE
       v_List  ot_tab_fruit := ot_tab_fruit(tab_fruitList(ot_fruit('apple','red','tree'),
                                                          ot_fruit('blueberry','blue','bush')
       v_List2 ot_tab_fruit := ot_tab_fruit(tab_fruitList());
    BEGIN
      SELECT CAST ( MULTISET ( SELECT * FROM TABLE(v_List)
                               ORDER BY 2, 3, 1
                               <b> -- This compiles with ORA-22907 error
                                  AS  ot_tab_fruit</b>
                  ) INTO v_List2
      FROM DUAL;
      FOR i IN v_List2.FIRST..v_List2.LAST
      LOOP  
         DBMS_OUTPUT.PUT_LINE('i='||i||' descr='||v_List2(i).fruit.descr ||' color='||
               v_List2(i).fruit.color||' grown_by='||v_List2(i).fruit.grown_by);
      END LOOP;
    END;Thanks, Kate
    Message was edited by:
    johnsok

    This solution, which works perfectly by the way, came from Avi Abrami. I've highlighted the necessary changes to make the SELECT of a collection of objects work properly.
    create or replace type OT_FRUIT as object (
      DESCR     varchar2(100)
    ,COLOR     varchar2(50)
    ,GROWN_BY  varchar2(50)
    create or replace type TAB_FRUITLIST as table of OT_FRUIT;
    create or replace type OT_TAB_FRUIT as object (
      FRUIT  TAB_FRUITLIST
    DECLARE
       v_List  ot_tab_fruit := ot_tab_fruit(tab_fruitList(ot_fruit('apple','red','tree'),
                                                          ot_fruit('blueberry','blue','bush')
       v_List2 ot_tab_fruit := ot_tab_fruit(tab_fruitList());
    BEGIN
      SELECT CAST ( MULTISET ( SELECT * FROM TABLE(v_List.fruit)
                               ORDER BY 2, 3, 1
                                  AS tab_fruitlist
                  ) INTO v_List2.fruit
      FROM DUAL;
      FOR i IN v_List2.fruit.FIRST..v_List2.fruit.LAST
      LOOP
         DBMS_OUTPUT.PUT_LINE('i='||i||' descr='||v_List2.fruit(i).descr ||' color='||
               v_List2.fruit(i).color||' grown_by='||v_List2.fruit(i).grown_by);
      END LOOP;
    END;
    /

  • Calculate value based upon checkbox selection

    G'day people,
    I've got myself a bit stuck on a job I've got here, this javascript is getting the better of me.
    The idea is that this script takes the sub total, and adds a creditcard surcharge (as a percentage) based upon a checkbox selection, then spits out the value to be entered into another field.
    If anyone could have a quick look over the following and let me know where I've gone wrong, it would be appreciated.
    var subtotal = this.getField("SubTotal").value;
    var mastercardTick = this.getField("MasterCard");
    var visaTick = this.getField("Visa");
    var amexTick = this.getField("Amex");
    var surcharge = this.getField("CreditSurcharge").value;
    var creditcard = this.getField("PayCredit").value;
    if (creditcard.value === "Off") {
         event.value = 0;
    } else {
              if (mastercardTick.value === "Yes") {
                 surcharge.value= (1.2 / 100) * subtotal.value;
        } else if (visaTick.value === "Yes") {
                 surcharge.value = (1.2 / 100) * subtotal.value;
        } else if (amexTick.value === "Yes") {
                   surcharge.value = (3.75 / 100) * subtotal.value;
        } else {
              event.value = 0;

    Thanks George, I've given this a whirl and got very close... I got a NaN error, and found I was calling "SubTotal" a value twice, which was playing funny buggers!
    I've got rid of one part (the if creditcard.value === "Off") as it wasn't acting like it should. I think I had to put it in a seperate function, to be called seperately then the rest of the code... However, I need to get the job out and it wasn't crucial.
    Thanks for your help mate, appreciated.
    For anyone else that's interested, amended code is as follows:
    var subtotal = this.getField("SubTotal");
    var mastercardTick = this.getField("MasterCard");
    var visaTick = this.getField("Visa");
    var amexTick = this.getField("Amex");
    // var surcharge = this.getField("CreditSurcharge").value;
    var creditcard = this.getField("PayCredit").value;
              if (mastercardTick.value === "Yes") {
                 event.value = (1.2 / 100) * subtotal.value;
        } else if (visaTick.value === "Yes") {
                 event.value = (1.2 / 100) * subtotal.value;
        } else if (amexTick.value === "Yes") {
                   event.value = (3.75 / 100) * subtotal.value;
        } else {
              event.value = 0;
    Not the nicest, but hey, it worked.

  • Moving checkbox items into other group

    I have a very simple Word doc that when I have Acrobat automatically create a form from it, puts checkbox items into groups I need to change. For example, the grouping should be
    GroupA
    Item1
    Item2
    Item3
    Item4
    but what I get is
    GroupA
    Item1
    Item2
    GroupB
    Item3
    Item4
    I can't select and slide item3 and 4 into GroupA. And if I delete item3 and 4 and add a new field, the new field is always outside of GroupA, even if I select GroupA or any item inside of it first.
    I do have a way out: I can delete them all and then add multiple checkboxes as a group, but I would rather slide them around, as there are a lot more checkboxes than the four shown.  Anyone know how I can accomplish this?

    Jeff,
    Thanks for the response. I had tried the apex_item before but I couldn't get it to work. I have changed the SQL to include the apex_item commands then used them to define parameters in the javascript function then added parameters to the Application Process but I get no data found. Am I using the apex_item wrong in the SQL or the apex_application wrong in the javascript?
    Thanks,
    Bob
    SQL:_
    q := 'select apex_item.checkbox(1, empno||''~''||ename||''~''||job||''~''||hiredate, ''onclick="f_UpdateCollection(this)"'',a.c001) cbox, '||
    ' apex_item.display_and_save(2,empno) "EMPNO", '||
    ' apex_item.display_and_save(3,ename) "ENAME", '||
    Javascript:_
    function f_UpdateCollection( cb ){
    var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=UpdateCheckboxValue',0);
    get.addParam('x01',cb.value);
    get.addParam('x02',apex_application.g_f02);
    get.addParam('x03',apex_application.g_f03);
    get.GetAsync(function(){return;});
    get = null;
    Application Process:_
    declare
    l_value varchar2(4000);
    l_empno  varchar2(4000);
    l_ename  varchar2(4000);
    begin
    l_value := wwv_flow.g_x01;
    l_empno := wwv_flow.g_x02;
    l_ename := wwv_flow.g_x03;
    apex_collection.add_member(
    p_collection_name => l_collection_name,
    p_c005            => l_empno,
    p_c006            => l_ename,
    p_c010 => l_value );
    ...

  • How do you get  the count of number of  checkbox selected?

    hi,
    plz tell me how do you get the count of number of checkbox selected?

    Not sure what you are doing so I will attempt to answer your question. If have one question which can have multiple answers you have will recieve an array so you have to do getParameterValues("name") and move it into an array.
    If you have multiple questions and only value will be selected do a getParameter("name") on each form element.
    HTH, if not provide more detail.
    J.Clancey

  • Problem: CheckBox component into DataGrid

    Hello, this is my first post on this forum. This is my
    problem:
    First, i select a checkbox included into the DataGrid
    (populated with DataSet--->XMLConnector), but when i rollover
    the mouse on the check component, the checkbox turn off
    (deselected) automatically, and the value all time is "undefined";
    if i click, the checkbox turn selected (true), but when i rollout,
    automatically change to deselected.
    I use cellrenderer api to include the chackbox, the column of
    the checkbox not need DataSet data.
    Please, helpme. Thanxs.
    P.D. Sorry, my english isn`t good.

    don't use getNextHighestDepth().

  • A SELECT into a procedure

    Hello,Can I show the result of a SELECT .. FROM.. WHERE.. into a procedure?
    For example:
    CREATE OR REPLACE PROCEDURE nuova_ricerca (p_Stringa VARCHAR2)
    AS
    BEGIN
    SELECT *
    FROM ArchivioSoluzioni
    WHERE Problema LIKE ConvertiPerLike(p_Stringa);
    END;
    why I can use
    SELECT * INTO DUMMYArchivioSoluzione.Camp1, DUMMYArchivioSoluzione.Camp2..
    If the result of my SELECT is constructed by 2 rows?
    p.s
    ConvertiPerLike is a simple function.
    excuse for my bad english

    Do not copy the record Operatore in emprec...Why?Because
    SELECT * INTO emprec
    FROM Operatore;
    potentially returns MANY records (see my above post). If you want
    to get the result you have to restrict the selection with WHERE caluse
    which gaurantees you select ONE row, NOT MANY.
    If you want to select many rows you have to think of the collection
    and BULK COLLECT INTO statement:
    SQL> create or replace procedure foo
      2  is
      3   type t1 is table of emp%rowtype index by pls_integer;
      4   t t1;
      5  begin
      6   select * bulk collect into t from emp;
      7  end;
      8  /
    Procedure created.
    SQL> exec foo;
    PL/SQL procedure successfully completed.or to think of the cursor using as it was pointed out above:
    SQL>/* Just for illustration */
    SQL> create or replace procedure foo
      2  is
      3   erc emp%rowtype;
      4  begin
      5   for v in (select * from emp) loop
      6    erc := v;
      7   end loop;
      8  end;
      9  /
    Procedure created.
    SQL> exec foo;
    PL/SQL procedure successfully completed.Rgds.

  • Getting data into another collection from UNION of 2 collections

    Hi,
    I have a requirement like this.
    cursor c1 is
    select a,b,c,d from abc
    UNION
    select e,f,g,h from def;
    I am replacing cursor with collection variables.
    Created collection variables for both the select statements as
    select a,b,c,d BULK COLLECT INTO coll_abc from abc;
    select e,f,g,h BULK COLLECT INTO coll_def from def;
    Now, I want to get the UNION of both these collections into another collection variable.
    Can I write
    select * BULK COLLECT INTO coll_abc_def from coll_abc,coll_def;Thanks
    Rajiv

    Hi,
    I ran into some problem here.
    TYPE main_coll is RECORD (
         dte_ent_woc date,     
         sched_beg_dte_woc date,     
         inst_dte_woc date,     
         sub_acct_no_woc number,     
         wo_stat_woc varchar2(5),     
         wo_key_woc number);
    TYPE main_coll_typ IS TABLE OF main_coll;
    main_collection_union main_coll_typ;
    -- Declaration Ends
    BEGIN
       err_loc      := 10;
       file_name    := '14932_welcome_call_'               ||
                       TO_CHAR(TRUNC(SYSDATE), 'YYYYMMDD') ||
                       '.txt';
       file_handle  := UTL_FILE.fopen('/apps/custsrv/custsrv/data/output',
                                      file_name,
                                      'W');
       UTL_FILE.put_line(file_handle,
                         '"DV DATE"~"SCHEDULE DATE"~"INSTALL DATE"~"ACCOUNT
    #"~"ADDRESS1"~"ADDRESS2"~"CITY"~"STATE"~"ZIP"~"ACTIVATION DATE"~"CURRENT BALANCE"~"DV STATUS"~"ACCOUNT
    STATUS"~"RESTART DATE"~"IS DV LAST?"');
       err_loc      := 20;
    SELECT  dte_ent_woc,     
         sched_beg_dte_woc,     
         inst_dte_woc,     
         sub_acct_no_woc,     
         wo_stat_woc,     
         wo_key_woc
    BULK COLLECT INTO main_collection_union
    FROM ((SELECT dte_ent_woc,
                 sched_beg_dte_woc,inst_dte_woc,
                 sub_acct_no_woc,
                 wo_stat_woc,
                 wo_key_woc
            FROM woc_base_comp
           WHERE
              wo_typ_woc = 'DV'
             AND MOD(INSTR(wo_rsn_woc, 'BF'), 2) != 0)
          UNION
          SELECT /* index(a DTE_ENT_WOO_I) */
                  dte_ent_woo,
                  sched_beg_dte_woo,inst_dte_woo,
                  sub_acct_no_woo,
                  wo_stat_woo,
                  wo_key_woo
            FROM woo_base_open a
           WHERE
              wo_typ_woo = 'DV'
             AND MOD(INSTR(wo_rsn_woo, 'BF'), 2) != 0
             AND wo_stat_woo in ('X','O')
           );When I compiled, I got these errors...
    Error(146,10): PL/SQL: Statement ignored
    Error(146,51): PLS-00302: component 'SUB_ACCT_NO_WOC' must be declared
    Error(155,10): PL/SQL: SQL Statement ignored
    Error(159,35): PL/SQL: ORA-00904: "MAIN_COLLECTION_UNION"."DTE_ENT_WOC": invalid identifier
    .I understand that the declared collection is not being recognized.
    But, I am not getting where to declare and where to define the collection.
    Any help regarding this would be appreciated.
    Thanks
    Rajiv

  • Multiple checkbox selection in ALV and updating internal table

    Dear Expert,
    Can anyone tell me how to handle the multiple checkbox selection in ALV Grid report and then updating the internal table.
    I tried the option but it works only when i select only 1 row in ALV.
                    DO L_LINES TIMES.
                      read table icoas index rs_selfield-tabindex.
                      if sy-subrc = 0.
                        ICOAS-NOCHK = 'X'.
                        modify ICOAS INDEX rs_selfield-tabindex TRANSPORTING NOCHK.
                      ENDIF.
                    ENDDO.
    Requires help....
    Regards & Thanx,
    Bhupathi.

    Hi,
    Use this method to capture the check box event. Write this once you create your grid using CREATE OBJECT grid1.
    DATA:      GRID1 TYPE REF TO CL_GUI_ALV_GRID,
    CALL METHOD grid1->register_edit_event
      EXPORTING
        i_event_id = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED
      EXCEPTIONS
        ERROR      = 1
        others     = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
      LOOP AT T_GRIDDETAILS INTO WA_GRIDDETAILS.
        IF WA_GRIDDETAILS-CHECKBOX = 'X'.
                  "Do your operation
        ENDIF.
        CLEAR WA_GRIDDETAILS.
      ENDLOOP.

  • Selecting into a varray

    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE     11.2.0.3.0     Production
    TNS for HPUX: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    CREATE TABLE mytable
      JOB_REQUEST_ID       NUMBER(10),             
      USER_ID              NUMBER(6)  
    SET DEFINE OFF;
    Insert into MYTABLE
       (JOB_REQUEST_ID, USER_ID)
    Values
       (4610756, 7926);
    Insert into MYTABLE
       (JOB_REQUEST_ID, USER_ID)
    Values
       (4610756, 8318);
    Insert into MYTABLE
       (JOB_REQUEST_ID, USER_ID)
    Values
       (4610757, 7926);
    Insert into MYTABLE
       (JOB_REQUEST_ID, USER_ID)
    Values
       (4610757, 8318);
    Insert into MYTABLE
       (JOB_REQUEST_ID, USER_ID)
    Values
       (4610758, 7926);
    Insert into MYTABLE
       (JOB_REQUEST_ID, USER_ID)
    Values
       (4610758, 8318);
    COMMIT;this works fine for a comma delimited list
    SELECT job_request_id,
             LISTAGG (user_id, ',') WITHIN GROUP (ORDER BY user_id) user_ids
        FROM mytable
    GROUP BY job_request_id;
    JOB_REQUEST_ID     USER_IDS
    4610756     7926,8318
    4610757     7926,8318
    4610758     7926,8318however I'm getting an error when trying to select it into a varray I'm not quite sure what I am doing incorrectly.
    SELECT job_request_id,
             CAST (COLLECT (USER_ID) AS SYS.OdcinumberList) user_ids
        FROM mytable
    GROUP BY job_request_id;
    ORA-22814: attribute or element value is larger than specified in type

    sorry not following.
    the sys.odciNumberList is predefined in the sys schema as
    CREATE OR REPLACE TYPE ODCINumberList AS VARRAY(32767) of NUMBERand the following works ok.
    with t as (
               select 1 main_id,2 employee_id from dual union all
               select 2,3 from dual union all
               select 3,4 from dual union all
               select 4,5 from dual
    select  cast(collect(employee_id) as sys.OdciNumberList) thelist
      from  t;

  • Can I convert a collection into a collection set

    Hi,
    Is it possible to convert a collection into a collection set.  I have two scenarios I am trying to deal with right now.
    1.  I have two separate collections.  I would like to move one collection into another, such that collection A contains what was in collection A plus the collection B i move into it?
    2. I have photos I want to make into a collection and place into another collection.  The dialog box only allows you to select current collection sets.
    To do this do I really need to basically start over and create a new collection set and new collections in order to move them into the collection set?
    Thanks,
    Scott

    Not possible. Why don't you do this?
    Library-Grid View [ G ]
    Click on Collection B
    Cmd/CTRL A to select all
    Drag (by grabbing the thumbnail - not the frame) into Collection A.

Maybe you are looking for

  • Ipod mini isn't recognized by itunes or computer

    I have no idea what to do. I connect my ipod mini to my mac, the ipod recognizes that it's been connected but it doesn't show up within iTunes or in Finder. I have iTunes 7.7, Macbook 10.5.4 Any ideas? I want to update my music and this is really fru

  • How to highlight a row in tree table - jdev 11.1.2

    Hello: Given a key, I want to highlight (select/set currency) the corresponding row in a tree table. I thought the following code would highlight the row in the tree table that corresponds to the key, but nothing is highlighted in the tree table. ie-

  • Hide command line ebs password

    Hi All, is there a way to hide command line password for apps user. when start or stop ebs apps from command line, i have to type $adstrtal.sh apps/apps is there a way to hide this password. Thanks in advance.

  • Won't display images - Its probably something simple!

    Hey , Ive been trying for ages, looked throught the tutorials (i have even tried just using java pasted from the site for one of the simple programs) and looking through old forum questions but can't find out why my GUI wont display images. It compil

  • Filevault and Launch Services

    I am having the same problem that so many people reported with Mac OS 10.5: every time I log out, the Launch Services plist is erased. I shouldn't say "every time" since I can't be sure, but it just happened the last three times I logged out. I use F