Populate  Collection

Hi
I have a collection and will like populate with data from table
DECLARE
TYPE name_rec IS RECORD ( COD VARCHAR2(3), DESCR VARCHAR2(30) );
TYPE names IS VARRAY(250) OF name_rec;
    t_tab     names := names();
BEGIN
    t_tab.extend(1);
   dbms_output.put_line(t_tab.count());
  t_tab.delete;
  dbms_output.put_line(t_tab.count());
end;     How can I to do it ?

Michaels, please look into this,
It is not going beyond 'after exit' condition.
SQL> declare
  2     cur_emp sys_refcursor;
  3      type t_obj is record( empno number,
  4                           ename varchar2(25)
  5                           );
  6      type t_tab is table of t_obj index by binary_integer;
  7      tt t_tab;
  8      cnt_in number:=0;
  9      cnt_out number:=0;
10      begin
11       open cur_emp for
12       select empno,ename from emp where deptno=10;
13        loop
14         fetch cur_emp BULK collect into tt;
15         cnt_out:=cnt_out+1;
16         dbms_output.put_line('cnt_out :'||(cnt_out));
17         exit when cur_emp%notfound;
18           dbms_output.put_line('after exit');   
19        end loop;
20        for i in 1..tt.count loop
21           dbms_output.put_line('empno :' ||tt(i).empno||'     ename  :'||tt(i).ename);
22           cnt_in:=cnt_in+1;
23          dbms_output.put_line('cnt_in :'||(cnt_in));
24        end loop;
25      end;
26  /
cnt_out :1
empno :7782     ename  :CLARK
cnt_in :1
empno :7839     ename  :KING
cnt_in   :2
empno :7934     ename  :MI_LL_ER
cnt_in   :3
empno :7501     ename  :T*_1NU
cnt_in   :4

Similar Messages

  • Populate collection type from XMLType

    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE     11.1.0.7.0     Production
    TNS for Linux: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    Please bear with me as I'm new to this XML DB thing and also this is my first post.
    I'm trying to populate collection type from XMLType. I was able to populate a table from XMLType but
    couldn't figure out a way to populate the collection type. Here is the description of my problem:
    Object Type:
    CREATE OR REPLACE TYPE DOC_ROWTYPE AS OBJECT
         REFERENCENUMBER VARCHAR2(255),
         REQID NUMBER(12),
         REQDETID NUMBER(12),
         FROMAMOUNT VARCHAR2(31),
         TOAMOUNT VARCHAR2(31),
         TOACCOUNTID NUMBER(12),
         TOACCOUNTNUMBER VARCHAR2(35),
         FROMACCOUNTID NUMBER(12),
         FROMACCOUNTNUMBER VARCHAR2(35),
    Collection Type:
    CREATE OR REPLACE TYPE DOC_TABLETYPE IS TABLE OF DOC_ROWTYPE;
    I have a physical table which is created when I registered a schema.
    A table (Temp_Result) got created with column SYS_NC_ROWINFO$ which is of XMLType.
    As you can see this is only a temporary table which will store the response XML which I want to finally get it to collection type.
    XML to parse:
    <code>
    <TFSResponse>
    <TFS>
    <refNumber>12345</refNumber>
    <reqId>123</reqId>
    <reqDetId>111</reqDetId>
    <fromAmount>20</fromAmount>
    <toAmount>20</toAmount>
    <fromAccount>
    <accountId>22222</id>
    <accountNumber>12345678</number>
    </fromAccount>
    <toAccount>
    <accountId>33333</id>
    <accountNumber>123456789</number>
    </toAccount>
    </TFS>
    .... many TFS Tags
    </TFSResponse>
    </code>
    So each object in the collection is one TFS tag.
    Any advice on how to implement this?

    Does this help
    SQL> CREATE OR REPLACE TYPE ACCOUNT_T as OBJECT (
      2    "accountId"       NUMBER(12),
      3    "accountNumber"   VARCHAR2(35)
      4  )
      5  /
    Type created.
    SQL> show errors
    No errors.
    SQL> --
    SQL> CREATE OR REPLACE TYPE TFS AS OBJECT(
      2     "refNumber"  VARCHAR2(255),
      3     "reqId"      NUMBER(12),
      4     "reqDetId"   NUMBER(12),
      5     "fromAmount" VARCHAR2(31),
      6     "toAmount"   VARCHAR2(31),
      7     "fromAccount" ACCOUNT_T,
      8     "toAccount"   ACCOUNT_T
      9  );
    10  /
    Type created.
    SQL> show errors
    No errors.
    SQL> --
    SQL> CREATE OR REPLACE TYPE TFS_C
      2      as TABLE of TFS
      3  /
    Type created.
    SQL> show errors
    No errors.
    SQL> --
    SQL> CREATE OR REPLACE Type TFS_RESPONSE_T as OBJECT(
      2    "TFSResponse" TFS_C
      3  );
      4  /
    Type created.
    SQL> show errors
    No errors.
    SQL> /
    Type created.
    SQL> CREATE OR REPLACE type CODE_T as OBJECT(
      2    "code" TFS_RESPONSE_T
      3  );
      4  /
    Type created.
    SQL> show errors
    No errors.
    SQL> --
    SQL>
    SQL> with "MY_XML" as
      2  (
      3    select XMLTYPE(
      4  '<code>
      5     <TFSResponse>
      6             <TFS>
      7                     <refNumber>12345</refNumber>
      8                     <reqId>123</reqId>
      9                     <reqDetId>111</reqDetId>
    10                     <fromAmount>20</fromAmount>
    11                     <toAmount>20</toAmount>
    12                     <fromAccount>
    13                             <accountId>22222</accountId>
    14                             <accountNumber>12345678</accountNumber>
    15                     </fromAccount>
    16                     <toAccount>
    17                             <accountId>33333</accountId>
    18                             <accountNumber>123456789</accountNumber>
    19                     </toAccount>
    20             </TFS>
    21             <TFS>
    22                     <refNumber>12346</refNumber>
    23                     <reqId>123</reqId>
    24                     <reqDetId>111</reqDetId>
    25                     <fromAmount>20</fromAmount>
    26                     <toAmount>20</toAmount>
    27                     <fromAccount>
    28                             <accountId>22222</accountId>
    29                             <accountNumber>12345678</accountNumber>
    30                     </fromAccount>
    31                     <toAccount>
    32                             <accountId>33333</accountId>
    33                             <accountNumber>123456789</accountNumber>
    34                     </toAccount>
    35             </TFS>
    36             <TFS>
    37                     <refNumber>12347</refNumber>
    38                     <reqId>123</reqId>
    39                     <reqDetId>111</reqDetId>
    40                     <fromAmount>20</fromAmount>
    41                     <toAmount>20</toAmount>
    42                     <fromAccount>
    43                             <accountId>22222</accountId>
    44                             <accountNumber>12345678</accountNumber>
    45                     </fromAccount>
    46                     <toAccount>
    47                             <accountId>33333</accountId>
    48                             <accountNumber>123456789</accountNumber>
    49                     </toAccount>
    50             </TFS>
    51     </TFSResponse>
    52  </code>') as "XML"
    53    from DUAL
    54  )
    55  select
    56    "TMOBILE"."CODE_T"(
    57      "TMOBILE"."TFS_RESPONSE_T"(
    58        CAST(
    59          MULTISET(
    60            select
    61              "TMOBILE"."TFS"(
    62                "refNumber_000002",
    63                "reqId_000003",
    64                 "reqDetId_000004",
    65                "fromAmount_000005",
    66                "toAmount_000006",
    67                "TMOBILE"."ACCOUNT_T"(
    68                  "accountId_000007",
    69                  "accountNumber_000008"
    70                ),
    71                 "TMOBILE"."ACCOUNT_T"(
    72                  "accountId_000009",
    73                  "accountNumber_000010"
    74                )
    75              )
    76              FROM
    77                XMLTABLE(
    78                  '/TFS'
    79                  passing "TFSResponse_000001"
    80                   COLUMNS
    81                   "refNumber_000002"                  VARCHAR2(255)                       PATH 'refNumber',
    82                   "reqId_000003"                      NUMBER                              PATH 'reqId',
    83                    "reqDetId_000004"                   NUMBER                              PATH 'reqDetId',
    84                   "fromAmount_000005"                 VARCHAR2(31)                        PATH 'fromAmount',
    85                    "toAmount_000006"                   VARCHAR2(31)                        PATH 'toAmount',
    86                     "accountId_000007"                  NUMBER                              PATH 'fromAccount/accountId',
    87                      "accountNumber_000008"              VARCHAR2(35)                        PATH 'fromAccount/accountNumber',
    88                     "accountId_000009"                  NUMBER                              PATH 'toAccount/accountId',
    89                      "accountNumber_000010"              VARCHAR2(35)                        PATH 'toAccount/accountNumber'
    90                )
    91          ) as "TMOBILE"."TFS_C"
    92        )
    93      )
    94    )
    95    FROM MY_XML,
    96      XMLTABLE(
    97        '/'
    98        passing "XML"
    99        COLUMNS
    100              "TFSResponse_000001"                XMLTYPE                             PATH 'code/TFSResponse/TFS'
    101       )
    102
    SQL> /
    CODE_T(TFS_RESPONSE_T(TFS_C(TFS('12345', 123, 111, '20', '20', ACCOUNT_T(22222, '12345678'), ACCOUNT_T(33333, '123456789')), TFS('12346', 123, 111, '20', '20',
    ACCOUNT_T(22222, '12345678'), ACCOUNT_T(33333, '123456789')), TFS('12347', 123, 111, '20', '20',
    ACCOUNT_T(22222, '12345678'), ACCOUNT_T(33333, '123456789')))))
    SQL>

  • SCCM 2012 Query to populate collection with users of 3 similar characters

    Hi, 
    I'm trying to create a query to populate a collection for my QA users. I have 5 QA users and about 10,000 users on the domain. Those users are inside a "TQA" group so I just need to know a way to create a dynamic collection that will be populated
    automatically with this TQA users and because of more people will be joining the ranks of QA testing the collection will help to mitigate maintenance.
    At the moment we have a query that doesn't works at all so I had to manually update my collections every time we test a product. My query code does not seems to populate with the info I need.
    This is the code:
    select SMS_R_USER.ResourceID,SMS_R_USER.ResourceType,SMS_R_USER.Name,SMS_R_USER.UniqueUserName,SMS_R_USER.WindowsNTDomain from SMS_R_User where SMS_R_User.UserPrincipalName = "TQA%" order by SMS_R_User.UserPrincipalName
    Any thoughts ?
    Kind Regards.

    If you're using % in the value field the operator must be "Like" . In your case, the query should look like
    select SMS_R_USER.ResourceID,SMS_R_USER.ResourceType,SMS_R_USER.Name,SMS_R_USER.UniqueUserName,SMS_R_USER.WindowsNTDomain from SMS_R_User where SMS_R_User.UserPrincipalName Like
    "TQA%" order by SMS_R_User.UserPrincipalName
    Kindly mark as answer/Vote as helpful if a reply from anybody helped you in this forum. Delphin

  • Populate collection from function using refcursor

    Hello,
    I have a question about table functions.
    I'm looking to develop a table function that populates a collection based on a select query. The idea is that the user can pass 1+ variable to a select query in the table function and return a collection of data dependent on the variables they choose, as:
    create type a1 is object (col1 varchar2(1000), col2 varchar2(1000), col3 varchar2(1000));
    --varchar2(1000) used for simplicity
    create type a2 is table of a1;
    create or replace
    function a3(p in varchar2)
    return a2
    is
    mycollection a2:= a2();
    myparam varchar2(10):= p;
    begin
    select a1(topic,null,info)
    bulk collect into mycollection
    from help
    where topic = myparam;
    return mycollection;
    end;
    This executes fine using
    select * from table(a3('ACCEPT'));
    but when I try to write this using a ref cursor instead (even though it might be less efficient) I can't work out how to return multiple columns in a function. I appreciate this is hopelessly wrong, and suspect I'm nowhere near populating type mycollection a2, but:
    create or replace function a4(p in varchar2)
    return a2
    is
    mycollection a2:=a2();
    myparam varchar2(10):=p;
    c_cursor sys_Refcursor;
    begin
    open c_cursor for select seq,info,topic from help where topic = myparam;
    loop
    fetch c_cursor into mycollection;
    exit when c_cursor%notfound;
    end loop;
    close c_cursor;
    return mycollection;
    end;
    This does not execute using
    select * from table(a4('ACCEPT'));
    and returns
    ORA-06504: PL/SQL: Return types of Result Set variables or query do not match
    ORA-06512: at "SYSTEM.A4", line 14
    06504. 00000 -  "PL/SQL: Return types of Result Set variables or query do not match"
    *Cause:    Number and/or types of columns in a query does not match declared
               return type of a result set  variable, or declared types of two Result
               Set variables do not match.
    *Action:   Change the program statement or declaration. Verify what query the variable
               actually refers to during execution.
    Could anyone show me how me how to populate a collection using a refcursor instead of bulk collect? Am using 11GR2.
    Thanks,
    TP,

    I'm looking to develop a table function that populates a collection based on a select query.
    That is pretty much the definition of a PIPELINED function.
    -- type to match emp record
    create or replace type emp_scalar_type as object
      (EMPNO NUMBER(4) ,
       ENAME VARCHAR2(10),
       JOB VARCHAR2(9),
       MGR NUMBER(4),
       HIREDATE DATE,
       SAL NUMBER(7, 2),
       COMM NUMBER(7, 2),
       DEPTNO NUMBER(2)
    -- table of emp records
    create or replace type emp_table_type as table of emp_scalar_type
    -- pipelined function
    create or replace function get_emp( p_deptno in number )
      return emp_table_type
      PIPELINED
      as
       TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
        emp_cv EmpCurTyp;
        l_rec  emp%rowtype;
      begin
        open emp_cv for select * from emp where deptno = p_deptno;
        loop
          fetch emp_cv into l_rec;
          exit when (emp_cv%notfound);
          pipe row( emp_scalar_type( l_rec.empno, LOWER(l_rec.ename),
              l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno ) );
        end loop;
        return;
      end;
    select * from table(get_emp(20))
    In this example the user would provide a 'DEPTNO' value and the query (at the end) would return the rows of the EMP table for that value.
    You can use your own TYPEs and add other parameters as needed.
    See 'Using Pipelined and Parallel Table Functions in the Data Cartridge Dev Guide
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28425/pipe_paral_tbl.htm
    And see all of the sections dealing with Pipelined functions in the PL/SQL dev guide
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/tuning.htm#sthref1525

  • SCCM collection Query - Wrong output

    Hi 
    We are working on Creating Dynamic SCCM collection which get populated based on following two condition
    1) Belongs to a Test OU in AD
    2) Doesn't have scom agent installed
    We have been trying to work out why following query doesn't populate collection with correct object instead populate by every object that exist in this OU. Seems like condition after AND is totally ignored. is there anything I am doing wrong here
    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_SERVICE on SMS_G_System_SERVICE.ResourceID =
    SMS_R_System.ResourceId where SMS_R_System.SystemOUName = "AD.local/Servers/DEV/Test" and SMS_G_System_SERVICE.DisplayName != "Microsoft Monitoring Agent"
    Where as below query is working and condition after AND is calculated and collection get populated with right objects.
    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_SERVICE on SMS_G_System_SERVICE.ResourceID =
    SMS_R_System.ResourceId where SMS_R_System.SystemOUName = "AD.MONASH.EDU/Managed/Servers/DEV/OCIO/SplunkTest" and SMS_G_System_SERVICE.DisplayName = "Microsoft Monitoring Agent"
    We tried with different combination such as "not like", "is null" etc etc. seems to us that as soon as we try have negative criteria after AND that criteria has been ignored.
    To my little knowledge of SQL query, condition after AND is not optional and has to meet, if it doesn't query should return no value.
    is this same with SCCM collection query? will appreciate if some one can shade some light here.
    Thank you in advance. 

    Thank you All for the reply
    Our End Goal is to be able to automate software/configuration deployment based on criteria we set. SCOM is first of the rank if you like and we want this to be hands off approach so when a server move into certain OU based on criteria server get populated
    into SCCM collection and SCCM pushes out software/configuration packages out to the server.
    but having said that if we have to create two collection to satisfy our two criteria than most likely we will need number of collections depending on numbers and types of criteria. This will make managing collection and their relationship more challenging
    and not sure if that is the path we want to take. This will need to be discussed through unless we find better solution.
    Thank you again

  • Button to add member to collection

    Hi,
    I created the following collection in the before-header page process and also created an updatable report region. How can I create a "ADD ROW" button in that region in order to add a member to the collection. That is, I want to be able to click the "ADD ROW" button so that it will call the PL/SQL to do wwv_flow_collection.add_member().
    Here is the collection:
    -- reset collection
    if apex_collection.collection_exists(p_collection_name => 'FUND') then
    apex_collection.delete_collection(p_collection_name => 'FUND');
    end if;
    -- populate collection
    apex_collection.create_collection_from_query(
    p_collection_name => 'FUND',
    p_query => 'select
    f.hr_form3_funding_pk,
    f.hr_vacancy_pk,
    f.budgeted_class,
    f.index_code,
    f.position_control_no,
    f.sub_fund,
    f.budget_program,
    f.project_code,
    f.grant_code,
    f.funding_percent
    from hr_form3_funding_new f
    where hr_vacancy_pk = 14448');

    Hi,
    I know this post is over a year old, however I am running into the same situation and was wondering if you were able to resolve adding a row to your collection.
    I have a similar create collection before header and have created an updateable sql report from the collection. I used the wizard to create an add row button without success and have also tried calling the following pl/sql process from a button on the report thinking that it would insert a row into the collection and would appear on the report when re-queried however this also does not work.
    APEX_COLLECTION.ADD_MEMBER (
    P_COLLECTION_NAME => 'AGMT_TMK',
    P_C001 => :P594_AGENCY_ID,
    P_C002 => :P594_AGMT_DOC_NO,
    P_C003 => null,
    P_C004 => null);
    Any pointers would be greatly appreciated.
    Thanks,
    Mike

  • How to show data in table on the basis of click on a row of another table

    Hi All,
    I want to show two tables. In first table the main objects show in turn there is another collection in that main object for which i want to show data in separate table.
    e.g.,
    ObjectA
      have the collection of ObjectBs
    when i select ObjectA in main table then all the collection Objects of ObjectBs shows in separate table. Plz help me how to handle this case ??

    hi,
    You can create two value nodes for storing these collections. The first one would be singleton node as it is the main list. Under that create the second node with singleton = false.
    e.g.
    ---NodeA
        --attrA1
        --attrA2
        --NodeB(singleton = false)
                --attrB1
                --attrB2
    Now populate collection of object A in NodeA and after adding element in NodeA populate respective elements in NodeB.
    IPrivate<View>View.INodeANode nodeA = wdContext.NodeAnode();
    for (Iterator  it = collectionA.iterator(); it.hasNext(); )
         ObjectA objA= it.next();
         IPrivate<View>View.INodeAElement nodeAElem= nodeA.createNodeAElement();
         wdCopyservice.copy Corresponding(objA,nodeAElem);
         nodeA.addElement(nodeAElem);
         Collection collectioB =objA.getCollectionB();
         for (Iterator  it1 = collectionB.iterator(); it1.hasNext(); )
             ObjectB objB= it1.next();
            IPrivate<View>View.INodeBNode nodeB = nodeAElem.nodeBnode();
            IPrivate<View>View.INodeAElement nodeBElem= nodeB.createNodeBElement();
            wdCopyservice.copy Corresponding(objB,nodeBElem);
            nodeB.addElement(nodeBElem);
    Bind NodeA to the first table and NodeB to second one.
    After that when you select record in first table automatically its corresponding records will be populated in second table.
    Hope this helps!
    Monalisa

  • Retrieving CLOB

    Hello experts,
    I am following the link:
    https://forums.oracle.com/thread/725735
    First, I am only trying to retrieve clob data (>32 k) from db to a Rich Text Editor field in apex app. I am not getting success for that field at all irrespective of how long is the text in db CLOB column. Using apex 4.0
    I did three things:
    1. added clob_get function in HTML Header and Body attribute of the page
    2. added anonymous block as On Load-after header process . The code populates collection named CLOB_CONTENT from db CLOB column
    3. added following code in Footer of the region which is holding Rich Text Editor item:
    <script type="text/javascript">
    <!--
    addLoadEvent(clob_get);
    //-->
    </script>
    But still the item does not get populated with any data. I feel either step3 is wrong ( I mean I may need to define addLoadEvent somewhere) or I am missing something else. Looks like clob_get function is not getting executed.
    Please help.
    Thanks,
    RN

    Might a plug-in be useful instead?
    http://www.danielmcghan.us/2013/04/enkitec-clob-load-plug-in-for-apex-in.html
    Scott

  • APEX_COLLECTION - where does the code go?

    I am trying to create my first APEX collection.
    Where does the code go?
    Do I create a region as a PL/SQL anonymous block?
    Please advise -
    Regards,
    Stan

    Hi,
    I think best is create page process where you create/populate collection
    Br,Jari

  • Dynamic pl sql cursor

    Hi.
    I've written a package with the intent of updating a number of fairly large tables.
    I'm using Oracle : 10.2.0
    the package has a main function called to update a set of tables.
    It loops through a table containing table names and column names (one on each row).
    It calls a second function for each (tablename,columnname) to ask it to update all the values in that table.column.
    This, in turn, calls my third 'calculate' function to recalculate the input table.column.
    It is running really slowly, as I wrote it in a 'find out how to do it' mode.
    The tables I am updating can have hundreds of thousands of rows.
    I reviewed some examples which recommended using bulk collect and forall to efficiently update a table.
    My question - it isn't clear if I can do this if the update of a field is accomplished by calling my third pl/sql function which
    resides in the package I am working in.
    summary:
    have a table with 3 columns: tablename, columnname and an 'in use' column (not previously mentioned).
    I loop through this table, and with each tablename/columname, I feed the data into a second function.
    this second function updates the table via a cursor, invoking a third function that calculates the new value.
    it is so slow.
    Is bulk collection/forall a workable approach to repopulating such a set of tables. If so I'll go pursue the details.
    If not, what is a recommended approach.
    I can post some code but it is just gross.
    Thanks
    Jeff

    Thanks for the suggestions.
    This is a one time system modification, part of a larger reorganization. Because the rest of the reorganization is
    going to take alot of time, I need to minimize the time this update process takes.
    My requirement is that I update a number of columns in a number of tables - which tables / columns are due
    to be updated are determined via a complex analysis.
    I already have finished the analysis and code that figures out what tables and columns need updating.
    This code populates a table that contains a column for tablename and a column for columname.
    Each row in this table represent a table and column that need recalculating.
    So now at runtime, I need to iterate through this table, and get the target table/column which required updating.
    For each iteration I need to 'open' the table, read all the rows and update the target column.
    The update is a fairly complex piece of parsing and analysis, so it is encapsulated in a function in my package.
    Therefore, my quest was to figure out if bulk collect was a reasonable/possible way to update the tables at runtime.
    I saw this code on the internet at
    {noformat}
    http://www.dba-oracle.com/plsql/t_plsql_dynamic.htm
    {noformat}
    as an example, and noticed that I seem to need to know the target table in a 'static' manner,
    i.e. the bulk collect into 'parameter' which is of a type declared for a given table
    so I can have a rowtype variable to stuff the data into from the bulk collect.
    DECLARE
      TYPE t_object_id_tab IS TABLE OF bulk_collect_test.object_id%TYPE;
      l_tab   t_object_id_tab;
    BEGIN
      -- Populate collection use in forall.
      SELECT object_id
      BULK COLLECT INTO l_tab
      FROM   bulk_collect_test
      WHERE  rownum < 101;
      FORALL i IN l_tab.first .. l_tab.last
        EXECUTE IMMEDIATE
          'UPDATE bulk_collect_test
           SET    object_id = object_id
           WHERE  object_id = :1'
           USING l_tab(i);
    END;
    /jeff

  • Query Statement Properties Criteria -- Server "Location"

    When I generally create queries to populate collections [Membership Rules] in SCCM 2012, I use: 
    System Resource.System OU Name is like "[OU location]%"
    However, I recently received a request to create a query collection based on an
    attribute location, instead of OU container.  I am having trouble composing the criteria for this new query.  Does anyone know how to create a query based on attribute location?  For example,
    the server site is "[xxxx]CS" and the attribute location name is
    "A"

    Thank you so much for your response and blog!
    I never knew of the AD attribute discovery feature.  I was confused since my servers were showing up in Assets and Compliance > Devices because I did an adsysdis for the proper domain and OU.
    I made created my query using System Resource.location is like "%A%"
    (after adding location as an AD attribute) all of my collections finally populated.  Thanks again!!

  • Exception Handling IR Report

    hi there,
    I have an interactive report, the SQL for which could fail for a number of reasons, is there any way to catch the individual exceptions and display a meaningful error message.
    Thanks...

    Hi Aparm,
    You can create an apex collection and build your interactive report on top of this collection. Create a PL-SQL process which will get executed before page header and populate collection data using your currect report query, you can handle all the exceptions in this process and display them using meaning error message.
    Search for apex collection or look at the apex documents to see examples of apex collections.
    Thanks,
    Manish

  • DB links, Bind variables & APEX reports performance

    Hello,
    So the problem is simply that I have two databases:
    A : Has table T1
    B : (APEX database)
    I have an APEX report that simply does the following
    Select col1, col2.. from A@dblink
    This is abviously straighforward, however, I start having considrable performance issues if I have any filters applied to this query using APEX items ( bind variables) :
    Select col1, col2.. from T1@dblink_A_B
    where col1 > :PX_item
    I ran the explain plan and noticed that using the bind variables forces the query to be done on database B, not A which is causing the performance issues.
    I am sure that many of you ran into this issue before, but does anyone know how to resolve this issue ? I am thinking about using Pipelined functions, but am not sure if that will work well if I have a lot of records returned by the query or if this will resolve the issue at all.... your thoughts are appreciated..
    Thanks,
    Sam

    I've always been able to work around my DB link issues in Apex. As suggested, driving_site hint should be tried. Oracle documentation on it isn't great, but I follow this:
    - don't bother including other hints together with driving_site, as they get stripped out when your sql is passed to the remote DB (as per driving_site hint).
    - if you have have subqueries - specifiy driving_site hint in that section of the SQL too. I don't have any proof that this is really required - but it doesnt hurt.
    - include driving_site hint even if all tables are remote. Careful of refs to pseudo cols like sysdate, user etc. I think they are taken as local refs - not remote. I havent tested this properly to confirm.
    - dumb down your test case to eliminate refs to sysdate, subqueries etc.
    - remember that items are text, so you'd need to do to_number(), to_date() on them where appropriate on them in your SQL at the least.
    Seeing as you control the content of your items, SQL injection is a reduced risk. Assuming that's not your top concern anyway, don't get carried away with the bind-variable vs literals debate. Apex does lots of nasty inefficient stuff like IR searches. I'd never use an IR in something that really needs to be scalable anyway. Soo... construct SQL with littlerals based on your items (assuming item refs are the cause of your issue).
    region type=SQL Query (PL/SQL function body returning SQL query)
    begin
      return 'SELECT /*+ DRIVING_SITE(a) */ a.empno,a.ename,a.job,a.mgr,a.loc
            FROM emp@MY_DBLNK A
           WHERE  a.empno = '||:P123_EMPNO||'
           ORDER BY 1,2,3';
    end;Assuming your queries are expensive to execute (local or remote) and dont return too many records (else collection table can get really big), then caching the resultset in a collection gives you nice fast pagination, when using a PPR report. Keep a watch on the size of the collection table - truncate it manually if you accidentally populate it with a big cartesean product etc, else performance could degrade.
    Do main query to populate collection before header. PPR pagination doesnt reload the page, so before-header process only runs once. In my case it works like:
    -- reload button to re-load page, to force a query re-run. The html_Submit_Progress thing loads an 'busy processing' image.
    <input type="button" value="Run query" onclick="javascript:this.disabled=true;this.value='Running...';html_Submit_Progress(this);"  id="SUBMIT"  />
    -- On Load - before header process to populate collection (call in a regular region to see errors, until ironed out)
    declare
      q varchar2(4000);
      v_t0   PLS_INTEGER := DBMS_UTILITY.get_time;
    begin
       :P0_QSEC := '0';
      IF APEX_COLLECTION.COLLECTION_EXISTS(P_COLLECTION_NAME=> 'Q1')
      THEN
        APEX_COLLECTION.DELETE_COLLECTION(P_COLLECTION_NAME=>'Q1');
      END IF;
      if (:P0_DBLNK is not null) then
        q:= 'SELECT /*+ DRIVING_SITE(a) */ a.empno,a.ename,a.job,a.mgr,a.loc
            FROM emp@'||:P0_DBLNK||' a
           WHERE a.job like "M%"
            AND a.empno = #EMPNO#
           ORDER BY 1,2,3';
        q:= replace(q, '"', '''');
        q:= replace(q, '#EMPNO#', :P123_EMPNO);
        -- bulk
        APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY_B(
            P_COLLECTION_NAME => 'Q1',
            P_QUERY => Q);
       -- record count
       -- APEX_COLLECTION.collection_member_count
      end if;
      -- display in page footer or whatever
      :P0_QSEC := TO_CHAR ((DBMS_UTILITY.get_time - v_t0) / 100, '000.00') || ' sec';
    exception
      when others then
      raise_application_error(-20501, :P0_DBLNK||'< br >'||sqlerrm||'< br >'||q );
    end;
    -- then PPR report is just like
    Select C001, C002, C003, C004, C005
    From apex_collections
    Where collection_name = 'Q1'
    order by seq_id;Edited by: maceyah on Sep 7, 2011 9:26 AM
    Useful link on bind variables for CREATE_COLLECTION_FROM_QUERY_B ==> https://forums.oracle.com/forums/thread.jspa?threadID=2305634&tstart=0
    Edited by: maceyah on Mar 2, 2012 3:18 PM

  • How to use HTML or XML described visual forms for data entry in Java app?

    Hi,
    We are considering to use HTML as a mean of configuration for visual content and layout of data entry dialogs in our Java GUI applications. Java program will need to be able to populate/collect data into/from dialog controls. I am guessing that JEditorPane and FormView classes could be used for this but I have not figured out yet how to do this.
    I would really appreciate any help you could provide with respect to this. Please share any tips, utilities, references, etc. Maybe one can suggest non-HTML (e.g. XML, UIML, ...) way to achieve the same requirements and recommend some utilities respectively.
    Thanks.
    -Vitaly

    Just to clarify, we need a solution for Java application (no applet, no web server, no servlets, no JSPs, no EJBs).
    -Vitaly

  • How to Show data in grouping with check boxes.

    Hi Experts,
    I am new to ADF and want to resolve one issue for my urgent project requirement.
    My Problem is :
    In Employee, Department relationship i need to show data in a grouping of departments like for Marketing department all the related employees should come in a single column.
    eg .
    Dept Name Emp Name
    Marketing Akshay Nitin Ritu
    Sales Neeraj Vikas Venu
    * All these department names and employees should come with check boxes and if i select one department all the employees should be checked.
    Please Please suggest any solution asap.
    Many Thanks in Advance.
    Regards,
    Nitin
    Edited by: user10980736 on Feb 7, 2011 8:32 AM

    hi,
    You can create two value nodes for storing these collections. The first one would be singleton node as it is the main list. Under that create the second node with singleton = false.
    e.g.
    ---NodeA
        --attrA1
        --attrA2
        --NodeB(singleton = false)
                --attrB1
                --attrB2
    Now populate collection of object A in NodeA and after adding element in NodeA populate respective elements in NodeB.
    IPrivate<View>View.INodeANode nodeA = wdContext.NodeAnode();
    for (Iterator  it = collectionA.iterator(); it.hasNext(); )
         ObjectA objA= it.next();
         IPrivate<View>View.INodeAElement nodeAElem= nodeA.createNodeAElement();
         wdCopyservice.copy Corresponding(objA,nodeAElem);
         nodeA.addElement(nodeAElem);
         Collection collectioB =objA.getCollectionB();
         for (Iterator  it1 = collectionB.iterator(); it1.hasNext(); )
             ObjectB objB= it1.next();
            IPrivate<View>View.INodeBNode nodeB = nodeAElem.nodeBnode();
            IPrivate<View>View.INodeAElement nodeBElem= nodeB.createNodeBElement();
            wdCopyservice.copy Corresponding(objB,nodeBElem);
            nodeB.addElement(nodeBElem);
    Bind NodeA to the first table and NodeB to second one.
    After that when you select record in first table automatically its corresponding records will be populated in second table.
    Hope this helps!
    Monalisa

Maybe you are looking for

  • Transfer rules are not exist for ECC Quality source system in BI Dev

    Hi, I Connected BI Dev system To ECC Dev and installed the sales, purchasing,... data flow, but here i am not getting the quality data to show the reports, to get Quality data  I established the connection between BI Dev and ECC QA, while installing

  • How do I change the admin name in the popup dialog

    I am giving my old MacBook (10.6.8) to my mother and for certain reasons I didn't want to wipe it clean but just clear out some of my stuff and transfer it to her.  Everything has been successful, including changing the User directory name from mine

  • LINK to Database with different GLOBAL_NAME

    Could anybody help me? We have two databases with different GLOBAL_NAME parameter. First database has GLOBAL_NAME=true, second - 'false'. I would like to make LINK from first database to second. If I make link name as a simple word ('DBST'- for examp

  • PLD - Line Text

    Hi Members, I want to include the line text in the PLD of sale order. I need to include the line text  after the item description is displayed. I am getting the line text in PLD but its not in proper order. I need to show the line text after item des

  • Aperture running slow on my macbook Pro

    Hi, I have a 2.0 GHZ macbook Pro with 2G of ram and a 7200RPM hard drive. Processing runs smoothly when I first start Aperture, but gradually, the computer starts to slow down (the CPU gauge jumps), and the computer actually pauses for several second