Collections in a function

I have a
funcpacka.func1 (a function in a package), funcpacka.collection ( a collection in a package)
and
procpackb.proc1 ( a procedure in a package)
from sqlplus when i call procpackb.proc1 it tries to populate funcpacka.collection
and later when i call funcpacka.func1 as a table function it retreieves these values just fine.
however if i look to do this is a single call to funcpacka.func1 and inside this i make a call to procpackb.proc1 to populate and retreieve the collection it does not work .. i am aware that dml in a table function does not work, and would need to use an autonomous block .. still no
do u see anything wrong here

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

Similar Messages

  • Catching collection returned by function in SQL statement

    I am having a select query as : (I need all the values returned by the function in the select list)
    select t1.col1,t2.col2, (select t.a,t.b,t.c from fn(t2.col3) t)
    from
    t1,t2
    where t1.col1=t2.col2;
    My function is like :
    fn(t2.col3) returns a table in object format
    Here I was able to select only one value from table returned by the funcation at a time.If I select all the values as above it was giving too many vales error.
    Please any one help me in this

    user13044793 wrote:
    I am having a select query as : (I need all the values returned by the function in the select list)
    select t1.col1,t2.col2, (select t.a,t.b,t.c from fn(t2.col3) t)
    from
    t1,t2
    where t1.col1=t2.col2;Any specific reason for doing this? It adds an additional complexity to the SQL projection, and there's the additional costs of context switching to the PL/SQL engine (per row). All in all - not your typical approach and one that should have sound justification.
    As for the basic method - the multiset() SQL function needs to be used to create a collection. Here's a basic example of the approach:
    SQL> create or replace type TFoo as object(
      2          id      number,
      3          bar     varchar2(5)
      4  );
      5  /
    Type created.
    SQL>
    SQL> create or replace type TFooSet as table of TFoo;
      2  /
    Type created.
    SQL>
    SQL> create or replace function GetSomeFoo( n number ) return TFooSet is
      2          foo     TFooSet;
      3  begin
      4          foo := new TFooSet();
      5          foo.Extend( 5 );
      6 
      7          for i in 1..5
      8          loop
      9                  foo(i) := new TFoo( n+i-1, to_char(i-1,'0000') );
    10          end loop;
    11 
    12          return( foo );
    13  end;
    14  /
    Function created.
    SQL>
    SQL> select
      2          object_id,
      3          object_name,
      4          cast(
      5                  multiset( select * from table(GetSomeFoo(object_id)) ) as TFooSet
      6          )       as FOO
      7  from       all_objects
      8  where      owner = 'SYS'
      9  and        rownum <= 5;
    OBJECT_ID OBJECT_NAME                    FOO(ID, BAR)
         27538 /1000e8d1_LinkedHashMapValueIt TFOOSET(TFOO(27538, ' 0000'), TFOO(27539, ' 0001')
                                              , TFOO(27540, ' 0002'), TFOO(27541, ' 0003'), TFOO
                                              (27542, ' 0004'))
         28544 /1005bd30_LnkdConstant         TFOOSET(TFOO(28544, ' 0000'), TFOO(28545, ' 0001')
                                              , TFOO(28546, ' 0002'), TFOO(28547, ' 0003'), TFOO
                                              (28548, ' 0004'))
         11718 /10076b23_OraCustomDatumClosur TFOOSET(TFOO(11718, ' 0000'), TFOO(11719, ' 0001')
                                              , TFOO(11720, ' 0002'), TFOO(11721, ' 0003'), TFOO
                                              (11722, ' 0004'))
         30094 /100c1606_StandardMidiFileRead TFOOSET(TFOO(30094, ' 0000'), TFOO(30095, ' 0001')
                                              , TFOO(30096, ' 0002'), TFOO(30097, ' 0003'), TFOO
                                              (30098, ' 0004'))
        684122 /1023e902_OraCharsetUTFE       TFOOSET(TFOO(684122, ' 0000'), TFOO(684123, ' 0001
                                              '), TFOO(684124, ' 0002'), TFOO(684125, ' 0003'),
                                              TFOO(684126, ' 0004'))
    SQL>
    SQL> with dataset as(
      2          select
      3                  object_id,
      4                  object_name,
      5                  cast(
      6                          multiset( select * from table(GetSomeFoo(object_id)) ) as TFooSet
      7                  )                as FOO
      8          from    all_objects
      9          where   owner = 'SYS'
    10          and     rownum <= 5
    11  )
    12  select
    13          d.object_id,
    14          d.object_name,
    15          f.id,
    16          f.bar
    17  from   dataset d,
    18          table(d.foo) f
    19  /
    OBJECT_ID OBJECT_NAME                            ID BAR
           217 DUAL                                  217  0000
           217 DUAL                                  218  0001
           217 DUAL                                  219  0002
           217 DUAL                                  220  0003
           217 DUAL                                  221  0004
           268 SYSTEM_PRIVILEGE_MAP                  268  0000
           268 SYSTEM_PRIVILEGE_MAP                  269  0001
           268 SYSTEM_PRIVILEGE_MAP                  270  0002
           268 SYSTEM_PRIVILEGE_MAP                  271  0003
           268 SYSTEM_PRIVILEGE_MAP                  272  0004
           271 TABLE_PRIVILEGE_MAP                   271  0000
           271 TABLE_PRIVILEGE_MAP                   272  0001
           271 TABLE_PRIVILEGE_MAP                   273  0002
           271 TABLE_PRIVILEGE_MAP                   274  0003
           271 TABLE_PRIVILEGE_MAP                   275  0004
           274 STMT_AUDIT_OPTION_MAP                 274  0000
           274 STMT_AUDIT_OPTION_MAP                 275  0001
           274 STMT_AUDIT_OPTION_MAP                 276  0002
           274 STMT_AUDIT_OPTION_MAP                 277  0003
           274 STMT_AUDIT_OPTION_MAP                 278  0004
           815 RE$NV_LIST                            815  0000
           815 RE$NV_LIST                            816  0001
           815 RE$NV_LIST                            817  0002
           815 RE$NV_LIST                            818  0003
           815 RE$NV_LIST                            819  0004
    25 rows selected.
    SQL>

  • Returning Collection using table function

    Hi,
    I'm trying to return a collection with record type using table function but facing some issues.
    Could someone help me with it.
    SUNNY@11gR1> create or replace package test_pack as
      2  type rec_typ is record (
      3  empname varchar2(30),
      4  empage number(2),
      5  empsal number(10));
      6  type nest_typ is table of rec_typ;
      7  function list_emp return nest_typ;
      8  end;
      9  /
    Package created.
    Elapsed: 00:00:00.01
    SUNNY@11gR1> create or replace package body test_pack is
      2  function list_emp return nest_typ is
      3  nest_var nest_typ := nest_typ();
      4  begin
      5  nest_var.extend;
      6  nest_var(nest_var.last).empname := 'KING';
      7  nest_var(nest_var.last).empage := 25;
      8  nest_var(nest_var.last).empsal := 2500;
      9  nest_var.extend;
    10  nest_var(nest_var.last).empname := 'SCOTT';
    11  nest_var(nest_var.last).empage := 22;
    12  nest_var(nest_var.last).empsal := 3500;
    13  nest_var.extend;
    14  nest_var(nest_var.last).empname := 'BLAKE';
    15  nest_var(nest_var.last).empage := 1;
    16  return nest_var;
    17  end;
    18  end;
    19  /
    Package body created.
    Elapsed: 00:00:00.01
    SUNNY@11gR1> select * from table(test_pack.list_emp);
    select * from table(test_pack.list_emp)
    ERROR at line 1:
    ORA-00902: invalid datatype
    Elapsed: 00:00:00.01
    SUNNY@11gR1>Regards,
    Sunny

    But if I use pipelined function instead then I'm able to retrieve the records
    SUNNY@11gR1> create or replace package test_pack as
      2  type rec_typ is record (
      3  empname varchar2(30),
      4  empage number(2),
      5  empsal number(10));
      6  type nest_typ is table of rec_typ;
      7  function list_emp return nest_typ pipelined;
      8  end;
      9  /
    Package created.
    SUNNY@11gR1> ed
    Wrote file afiedt.buf
      1  create or replace package body test_pack as
      2  function list_emp return nest_typ pipelined is
      3  rec_var rec_typ;
      4  begin
      5  rec_var.empname := 'KING';
      6  rec_var.empage := 24;
      7  rec_var.empsal := 10000;
      8  pipe row(rec_var);
      9  rec_var.empname:='SCOTT';
    10  rec_var.empage:=22;
    11  rec_var.empsal:=2000;
    12  pipe row(rec_var);
    13  rec_var.empname:='BLAKE';
    14  rec_var.empage:='1';
    15  pipe row(rec_var);
    16  return;
    17  end;
    18* end;
    SUNNY@11gR1> /
    Package body created.
    Elapsed: 00:00:00.01
    SUNNY@11gR1> select * from table(test_pack.list_emp);
    EMPNAME                            EMPAGE     EMPSAL
    KING                                   24      10000
    SCOTT                                  22       2000
    BLAKE                                   1       2000
    Elapsed: 00:00:00.00Why is that?
    Regards,
    Sunny

  • Using CAST/COLLECT with a function

    I have a select statement that gathers comments into a report by user ID and Project Name.
    This works really well until I get to a point where the total comments exceeds 4000 characters, then I get a "character string buffer too small".
    Is there another way to gather the comments and report on them in APEX?
    Here is the Select Statement:
    /** START SELECT
    SELECT
    PROJECT_NAME, USER_ID, COLLECT_FUNC(CAST(COLLECT (USER_NOTES) AS VARCHAR2_T)) as COMMENTS
    FROM
    TBL_PROJECT
    where PROJ_DATE >= to_date('5/1/2011','MM/DD/YYYY') and PROJ_DATE <= to_date('6/30/2011','MM/DD/YYYY')
    PROJECT_NAME, USER_ID
    order by USER_ID;
    /** END SELECT
    Where the VARCHAR2_T is:
    CREATE OR REPLACE TYPE "VARCHAR2_T" as table of varchar2(4000)
    and the function that collects the comments is:
    /*** START CODE
    create or replace function collect_func (t in varchar2_t)
    return varchar2
    as
    ret varchar(4000) := '';
    i number;
    begin
    i := t.first;
    while i is not null loop
    if ret is not null then
    ret := ret || ' -- <BR> ';
    end if;
    ret := ret || t(i);
    i := t.next(i);
    end loop;
    return ret;
    end;
    /*** END CODE

    SleepDeprivedInSeattle wrote:
    I created a workspace at http://apex.oracle.com
    The user name is: TEST_USER
    Password is: myPassword1!You need to tell us the workspace name as well.
    If you go to the SQL Workshop, SQL Commands window and try to execute:
    SELECT
    PROJECT_NAME, USER_ID, COLLECT_FUNC(CAST(COLLECT (COMMENTS_FLD) AS VARCHAR2_T)) as COMMENTS
    FROM
    TBL_PROJECT
    group by PROJECT_NAME, USER_ID
    order by USER_ID;
    It will work for 10 row. But if you select 1000 rows, it fails because one of the projects has more than 4000 characters in the COMMENTS_FLD field. I expanded the VARCHAR to 6000 and it still fails.The VARCHAR2maximum size of <tt>VARCHAR2</tt> value that can be returned in Oracle SQL is 4000 bytes.
    To return more than 4000 bytes, modify <tt>collect_func</tt> to return a CLOB, or use a different string aggregation technique. I normally (ab)use XMLDB for this as it:
    <li>allows for either VARCHAR2 or CLOB output
    <li>doesn't require any additional objects or privileges
    <li>produces clean and properly structured XHTML without a lot of tedious and unreadable concatenations (my colleagues point out that it introduces a lot of tedious and unreadable XMLDB stuff instead)
    SQL> select
      2            d.deptno
      3          , d.dname
      4          , xmlserialize(
      5             content
      6             xmlelement(
      7                 "ul"
      8               , xmlagg(
      9                  xmlelement("li", e.ename)
    10                  order by e.ename
    11                 )
    12             )
    13             as clob
    14             indent size=2
    15            ) employees
    16  from
    17            dept d
    18           join emp e on d.deptno = e.deptno
    19  group by
    20            d.deptno
    21          , d.dname
    22  order by
    23            d.deptno
    24*          , d.dname
    SQL> /
        DEPTNO DNAME       EMPLOYEES
         10 ACCOUNTING       <ul>
                       <li>CLARK</li>
                       <li>KING</li>
                       <li>MILLER</li>
                     </ul>
         20 RESEARCH       <ul>
                       <li>ADAMS</li>
                       <li>JONES</li>
                       <li>SCOTT</li>
                       <li>SMITH</li>
                     </ul>
         30 SALES       <ul>
                       <li>ALLEN</li>
                       <li>BLAKE</li>
                       <li>JAMES</li>
                       <li>MARTIN</li>
                       <li>TURNER</li>
                       <li>WARD</li>
                     </ul>
         40 OPERATIONS       <ul>
                       <li>FORD</li>
                     </ul>Note that there is a 32K limit on the total size of a report row in APEX, including all data and mark-up.

  • PS...Collective PR indicator Functionality

    Hi,
    I am using collective PR functionality in projects. When I upload the material from external Excel sheet and transfer the BOM, single PR is getting created in the system, however the item nos in PR are not identical with the sr. nos. given in excel sheet. If you have any information on this please share.
    KPG

    Hi
    Did you give the WBS elements the materials should be assigned to in the excel.  If you have given WBS there then the items in the PR will be according to the WBS I think. Any please verify.
    Regards
    Sagar

  • How to use object type collection in my function?

    Hi,
    I want to declare Object type collection with in my function like same a Record type collection. But it is saying error like below
    PLS-00540: object not supported in this context.
    Can anyone tell me how can i resolve this? I don't want to go with create object type functionality.
    Thanks

    Hi below is my full query.
    SELECT  czci.config_hdr_id,
            czci.config_rev_nbr,
            asoqla.quantity,
             (SELECT 
                    node_desc.LOCALIZED_STR
                 FROM   CZ_LOCALIZED_TEXTS node_desc,
                        CZ_PS_NODES ps_nodes,
                        CZ_CONFIG_ITEMS czci1
                WHERE   czci1.config_hdr_id = asoqld.config_header_id
                AND     czci1.config_rev_nbr = asoqld.config_revision_num
                AND    node_desc.INTL_TEXT_ID = ps_nodes.INTL_TEXT_ID
                AND     NVL(node_desc.LANGUAGE,userenv('LANG')) = userenv('LANG')
                AND     czci1.PS_NODE_ID = ps_nodes.PERSISTENT_NODE_ID
                 AND    ps_nodes.DEVL_PROJECT_ID = (SELECT MAX(DEVL_PROJECT_ID) FROM CZ_PS_NODES WHERE PERSISTENT_NODE_ID = czci.PS_NODE_ID)
                AND czci.PARENT_CONFIG_ITEM_ID IN (SELECT sub_sub.CONFIG_ITEM_ID FROM CZ_CONFIG_ITEMS sub_sub
                                                        WHERE sub_sub.CONFIG_HDR_ID = asoqld.config_header_id
                                                        AND sub_sub.CONFIG_REV_NBR = asoqld.config_revision_num
                                                        AND      sub_sub.PS_NODE_NAME = 'fittings')) fitting_material,
             (SELECT 
                    node_desc.LOCALIZED_STR
                 FROM   CZ_LOCALIZED_TEXTS node_desc,
                        CZ_PS_NODES ps_nodes,
                        CZ_CONFIG_ITEMS czci
                WHERE   czci.config_hdr_id = asoqld.config_header_id
                AND     czci.config_rev_nbr = asoqld.config_revision_num
                AND    node_desc.INTL_TEXT_ID = ps_nodes.INTL_TEXT_ID
                AND NVL(node_desc.LANGUAGE,userenv('LANG')) = userenv('LANG')
                AND     czci.PS_NODE_ID = ps_nodes.PERSISTENT_NODE_ID
                 AND    ps_nodes.DEVL_PROJECT_ID = (SELECT MAX(DEVL_PROJECT_ID) FROM CZ_PS_NODES WHERE PERSISTENT_NODE_ID = czci.PS_NODE_ID)
                AND czci.PARENT_CONFIG_ITEM_ID IN (SELECT sub_sub.CONFIG_ITEM_ID FROM CZ_CONFIG_ITEMS sub_sub
                                                        WHERE sub_sub.CONFIG_HDR_ID = czci.CONFIG_HDR_ID
                                                        AND sub_sub.CONFIG_REV_NBR = czci.CONFIG_REV_NBR
                                                        AND      sub_sub.PS_NODE_NAME = 'tubing')) tubing_material,
            NVL((SELECT czci.item_val
             FROM cz_config_items czci
             WHERE     czci.config_hdr_id = asoqld.config_header_id
             AND czci.config_rev_nbr = asoqld.config_revision_num
             AND czci.value_type_code <> 4
             AND czci.ps_node_name = 'control_circuit_name'),
             (SELECT 
                    node_desc.LOCALIZED_STR
                 FROM   CZ_LOCALIZED_TEXTS node_desc,
                        CZ_PS_NODES ps_nodes,
                        CZ_CONFIG_ITEMS czci
                WHERE   czci.config_hdr_id = asoqld.config_header_id
                AND     czci.config_rev_nbr = asoqld.config_revision_num
                AND    node_desc.INTL_TEXT_ID = ps_nodes.INTL_TEXT_ID
                AND NVL(node_desc.LANGUAGE,userenv('LANG')) = userenv('LANG')
                AND     czci.PS_NODE_ID = ps_nodes.PERSISTENT_NODE_ID
                 AND    ps_nodes.DEVL_PROJECT_ID = (SELECT MAX(DEVL_PROJECT_ID) FROM CZ_PS_NODES WHERE PERSISTENT_NODE_ID = czci.PS_NODE_ID)
                AND czci.PARENT_CONFIG_ITEM_ID IN (SELECT sub_sub.CONFIG_ITEM_ID FROM CZ_CONFIG_ITEMS sub_sub
                                                        WHERE sub_sub.CONFIG_HDR_ID = czci.CONFIG_HDR_ID
                                                        AND sub_sub.CONFIG_REV_NBR = czci.CONFIG_REV_NBR
                                                        AND      sub_sub.PS_NODE_NAME = 'pneumatic_schematics'))
             ) schematic_name
    FROM    aso_quote_lines_all asoqla,
            aso_quote_line_details asoqld,
            cz_config_items czci
    WHERE   asoqla.quote_header_id = 58455
    AND     asoqla.item_type_code = 'MDL'
    AND     asoqla.quote_line_id = asoqld.quote_line_id 
    AND     asoqld.config_header_id = czci.config_hdr_id
    AND     asoqld.config_revision_num = czci.config_rev_nbrBelow is my explain plan
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.11       0.11          0          0          0           0
    Execute      2      0.01       0.01          0          0          0           0
    Fetch        3      0.06       0.06          0       3429          0          19
    total        6      0.18       0.18          0       3429          0          19That's what i am planning to write each select queries in a pipelined function then join all the functions. If i run one each query it is giving less query fetch
    Thanks

  • Query for collection is not function on SCCM 2012 R2

    Hi,
    I have a System Center 2012 R2 Config Manager as single management point. The SCCM is already have Endpoint Protection Point role installed. Then I need to create a new collection that contain all SCEP clients, to as deployment target of a rule and policy.
    I've try to create a query-based collection, with the following query language :
    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_INSTALLED_SOFTWARE on SMS_G_System_INSTALLED_SOFTWARE.ResourceId
    = SMS_R_System.ResourceId where SMS_G_System_INSTALLED_SOFTWARE.ProductName = "System Center 2012 Endpoint Protection"
    But after the collection is created, none of the emerging client that have SCEP installed.
    Earlier I have apply this query on the SCCM 2012 SP1 environtment, and it is work. But now I have migrate to the SCCM 2012 R2, and this query is seems not function on R2 version. 
    Is there difference query language between SCCM 2012 SP1 and R2?
    Thanks.
    Regards, Bar Waelah

    Hi,
    I saw System Center 2012 Endpoint Protection is under Installed Applications (64) node when I open Resource Explorer on a computer that installed System Center 2012 Endpoint Protection.
    So I edited your query, then these computers appeared on the collection.
    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_ADD_REMOVE_PROGRAMS_64 on SMS_G_System_ADD_REMOVE_PROGRAMS_64.ResourceID
    = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS_64.DisplayName like "System Center 2012 Endpoint Protection"
    Best Regards,
    Joyce Li
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Yoga 13: HID Sensor Collection : Auto-rotate functionality

    Hi Guys,
    I bought the Yoga 13 with Windows 8 but the non pro version.  I wanted the pro version on so I can connect to a domain so I did a clean install - where I deleted the partition with the old OS.
    Everything went great and all drivers that were are on the other partition that I left alone installed fine.
    Here is the problem:  I noticed that the auto-rotate functionality no longer works.  After doing some research I found that the HID Sensor Collection is what controls this.  If I look at the device manager I can see that their is a exclamation point next to the HID Sensor Collection Driver along with the Light Sensor driver.
    They both give me the error: 
    This device cannot start (Code 10). 
    The process hosting the driver for this device has terminated.
    I tried uninstalling and reinstalling the driver - this didn't help.
    I've tried searching for this driver online - no luck.
    I tried using the "update driver software" and it says:  Windows has determined that your driver software for this device is up to date.
    Any ideas how I can get the HID Sensor Collection working?
    Thanks for your help!
    Solved!
    Go to Solution.

    I had excatly the same problem after Windows 8 Pro N 64bit install, the device manager showed HID Sensor Collection and Light Sensor with exclamation points.
    I found out that this might have something to do with Windows User Mode Driver Framework, Windows Media Player contains and utilises it. As Windows 8 Pro N didn't contain Media player, I downloaded it as Media Feature Pack from http://www.microsoft.com/en-us/download/details.aspx?id=30685. After the install HID Sensor Collection and Light Sensor were fine. Also Simple Device Orientation Sensor appeared.

  • How java gets objet collections from DB function

    This is database function. my question is how java get those values from the function.
    Could you please post some sample code also?
    CREATE OR REPLACE
    Type T_PREO_RoleINFO is Object
    ROLE_ID NUMBER(10),
    ROLE_NAME VARCHAR2(20))
    CREATE OR REPLACE
    TYPE T_RoleInfo IS TABLE OF PREORDER.
    T_PREO_RoleINFO
    Function F_GetUserRole(Userid in number)
    return T_RoleInfo as
    V_Role T_RoleInfo;
    begin
         select T_PREO_RoleINFO(PREO_Role.ROLE_ID,PREO_Role.ROLE_NAME)
         BULK COLLECT INTO V_Role
         from preorder.PREO_Role, preorder.PREO_User_Role
         where PREO_Role.Role_id = PREO_User_Role.Role_id
         and PREO_User_Role.user_id = userid;
         return V_Role;
    end;

    check this out
    http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20878677.html

  • Incremental updates on collections/full schedule - Functional question

    Hi everyone,
    At a customer of mine we have the following set-up:
    Almost all applications are deployed User Based
    Collections are used for targetting the applications
    Incremental updates are enabled on practically all collections which deploy applications
    For the moment this setup is active for 498 collections (out of 714  collections).
    Since it's not advised and Microsoft recommends to only have incremental updates active for 200 collections, I would like to change this setup by means of POSH. I have just finished writing it, but I still have a functional question:
    Which schedule time would be best to activate for the collections? Keep the standard value to update collection every 7 days?
    When would you activate "incremental updates"? Device collections with required software for faster deployment time?
    I only foresee the following "downside":
    We have a lot of applications who are available to "all domain users". When the AD-account is created, it will sync with SCCM and will receive their deployements. But by changing the update schedule to, let's say, 7 days.. They wouldn't be able
    to see and install these applications if the collections haven't been updated yet?
    Thanks for the insight with your experience!
    Kr,
    Sven

    Wow Jörgen, thanks for this information! This was something I haven't read about. Will keep this in mind.
    In your blog, you mention that you use this tool to keep track of performance issues. When do you feel that there are too many collections which have incremental updates enabled (by using the tool)?
    The last weeks/months, we have a lot of issues during OSD. We have collections to which the TS is deployed.
    In orchestrator we have a runbook to add workstations to SCCM + add workstation to collection + update membership of collection. But the update takes from 5 minutes to 40 minutes.. So this is the main issue that we have..
    @Andrew: Thanks for your contribution! I believe you are speaking of "Global Conditions"? I haven't used it either, but I thought that this had some downsides.. For instance, we target most of the applications "Used Based" (since MS is
    moving to user centric deployment). So if I target the application to the "all users" collection and create a "global condition" to only install when user is a member of a specific AD-group (for instance: Skype), then the user still sees
    "skype" in the application catalog and will have an error upon installing it when he is not a member of the skype AD-group.
    Maybe this is completely wrong what I'm saying.. Just did some brainstorming with collegues but haven't found the time to play with it in a test environment. @Jörgen: Please enlighten us if I'm wrong.

  • Table function on a collection in Dynamic SQL

    Hello,
    I am trying to create a refcursor by selecting from a collection using table function.
    If I use the Select statement the query executes, but if I put the Select statement in a string
    the collection variable does not get resolved. The resaon I am putiing it in a string is because the
    WHERE clause will be passed a parameter. The code below is an anonymous block but will be changed to a
    procedure once I get it to work.
    I have tried many different ways but was unsuccessful.
    Please see if anybody cann assist or what I am trying to achive is not possible, so provide an alternative.
    The error I am getting is
    ORA-00904: "V_ALARM_REC_TABLE": invalid identifier
    ORA-06512: at line 50
    Thanks.
    Bimal
    DECLARE
    TYPE c_refcurtype IS REF CURSOR;
    x c_refcurtype;
    p_recordset c_refcurtype;
    v_rec mc2_dev2.mc2_alarm_rec_type := mc2_dev2.mc2_alarm_rec_type(null,null,null,null,null,null,null,null,
    null,null,null,null,null,null,null,null,
    null,null,null,null,null,null,null);
    v_alarm_rec_table mc2_dev2.mc2_alarm_rec_table := mc2_dev2.mc2_alarm_rec_table();
    v_select varchar2(200) := 'select a.* from ';
    v_table varchar2(200) := 'table(v_alarm_rec_table) a ';
    v_where varchar2(200) := 'where a.alarm_rule_def_uid = 9';
    v_query varchar2(32000);
    BEGIN
    MC2_ALARM.create_mc2_alarm(x, 1); --- ( X is a refcursor, which I will use to populate v_alarm_rec_table a (nested table collection)
    LOOP
    FETCH x INTO v_rec.record_cnt,
    v_rec.rn,
    v_rec.alarm_precision_order,
    v_rec.alarm_rule_def_uid,
    v_rec.alarm_type_def_uid,
    v_rec.alarm_rule_scope_uid,
    v_rec.trigger_tpl_master_uid,
    v_rec.alarm_scope_def_uid,
    v_rec.alarm_object_uid,
    v_rec.error_type,
    v_rec.all_error_codes,
    v_rec.enabled,
    v_rec.start_hour,
    v_rec.end_hour,
    v_rec.day_type,
    v_rec.alarm_severity_def_uid,
    v_rec.on_watch_duration,
    v_rec.update_on_status_change,
    v_rec.log_ind,
    v_rec.email_to,
    v_rec.email_from,
    v_rec.send_email,
    v_rec.stale_period;
    EXIT WHEN x%NOTFOUND;
    v_alarm_rec_table.extend;
    v_alarm_rec_table(v_alarm_rec_table.last) := v_rec;
    END LOOP;
    CLOSE x;
    v_query := v_select||v_table||v_where; -- ERROR OCCURS AT THIS LINE as it cannot resolve the TABLE name  v_alarm_rec_table)
    dbms_output.put_line('sql: '||v_query);
    OPEN p_recordset FOR v_query;
    LOOP
    FETCH p_recordset INTO v_rec.record_cnt,
    v_rec.rn,
    v_rec.alarm_precision_order,
    v_rec.alarm_rule_def_uid,
    v_rec.alarm_type_def_uid,
    v_rec.alarm_rule_scope_uid,
    v_rec.trigger_tpl_master_uid,
    v_rec.alarm_scope_def_uid,
    v_rec.alarm_object_uid,
    v_rec.error_type,
    v_rec.all_error_codes,
    v_rec.enabled,
    v_rec.start_hour,
    v_rec.end_hour,
    v_rec.day_type,
    v_rec.alarm_severity_def_uid,
    v_rec.on_watch_duration,
    v_rec.update_on_status_change,
    v_rec.log_ind,
    v_rec.email_to,
    v_rec.email_from,
    v_rec.send_email,
    v_rec.stale_period;
    EXIT WHEN p_recordset%NOTFOUND;
    some dbms_output statements...
    END LOOP;
    END;
    The error I am getting is
    ORA-00904: "V_ALARM_REC_TABLE": invalid identifier
    ORA-06512: at line 50

    Thanks Timur/Solomon,
    mc2_dev2 is the schema name.
    mc2_alarm_rec_table is a SQL type.
    Here are the scripts:
    CREATE OR REPLACE TYPE MC2_DEV2.mc2_alarm_rec_type IS OBJECT
    ( record_cnt NUMBER,
    rn number,
    alarm_precision_order NUMBER(6),
    alarm_rule_def_uid NUMBER(6),
    alarm_type_def_uid NUMBER(6),
    alarm_rule_scope_uid NUMBER(6),
    trigger_tpl_master_uid NUMBER(6),
    alarm_scope_def_uid NUMBER(6),
    alarm_object_uid NUMBER(6),
    error_type VARCHAR2(1),
    all_error_codes VARCHAR2(1),
    enabled VARCHAR2(1),
    start_hour NUMBER(2),
    end_hour NUMBER(2),
    day_type NUMBER(2),
    alarm_severity_def_uid NUMBER(6),
    on_watch_duration NUMBER(6),
    update_on_status_change VARCHAR2(1),
    log_ind VARCHAR2(1),
    email_to VARCHAR2(128),
    email_from VARCHAR2(128),
    send_email VARCHAR2(1),
    stale_period          NUMBER(6)
    CREATE OR REPLACE TYPE MC2_DEV2.MC2_ALARM_REC_TABLE IS TABLE OF MC2_DEV2.mc2_alarm_rec_type;
    If I popoulate the cursor with the following code:
    OPEN p_recordset FOR
    select a.* from table (v_alarm_rec_table) a where a.alarm_rule_def_uid = 9;
    there is no issue it works just fine.
    But when when I use
    OPEN p_recordset FOR v_query; ---- where v_query := v_select||v_table||v_where;
    the variable v_alarm_rec_table does not get resolved.
    Regards,
    Bimal

  • Auto Stats Collection on function based indexes

    In 10g does AUTO Stats Collection job in the default weeknight / weekend window collect stats on "function based indexes".
    Thank You
    Message was edited by:
    user449511
    I got the reply in another similar post posted by me some time earlier.
    Thank You
    Message was edited by:
    user449511

    SELECT job_name, comments
    FROM dba_scheduler_jobs;Then refine your search using the columns in the view.

  • How to calculate the total of absences? How to collect data from a specific line of a table?

    Hi,
    Again, I made a nice coloured picture from a screen capture which summarise the improvements that I would like to make in my form,
    Situation:
    For an educational purpose, I made this form   to simplify the way of recording the data and also to develope the independence of the students.
    ( I am doing this on a voluntary basis, working extra hours on my free time but I don't really mind because I am learning a lot of things in the same time)
    After being tested by the teacher, the student has to record the short date, the lines memorised, his grade, number of mistakes, and his attendance.
    I created everything in Word, then converted the file in PDF, then I created all the different fields with Adobe acrobat.
    There is in total 4 sheets, there are all similar except the first one in which there is a box with: date started, date finished, total time spent, absences.
    Below this box there is a table with 16 lines from (A to P) and 7 columns (Days, Date, From.. to.. , Grade, No. lines memorised, No. Errors, Attendance) ( so this table is present on all the sheets)
    Due to the fact that some students need more time than others, and also beacause some text need more time, I estimated a need of 4 sheets at the very most.
    I would like to make the following amelioration and automate the inputting of some of the data because I know that some of the students will certainly forget, so to avoid this scenario I am trying to make this form the easiest possible.
    screen capture of the form:
    screen capture of the form editing, you can see the names of the different fields:
    here is the form (only the first page) : http://cjoint.com/12fe/BBotMMgfYIy_memorisation_sheet_sample.pdf
    In  yellow 00000:
    At present, the students has to input the total of absences manually, is there a way ( script) to automate this by initialising the field next to "Absences" at  " 0 day"   and then everytime that Absent is selected from the COMBO BOX, it add 1 and it is displayed like this:  " 1 day" then " 2 days"  then " 3 days" etc … (so from what I read I have to initialise a counter a the beginning and then for (i...   ) count= count++; something like this...
    Furthermore, I need a solution to overcome the possibility that a second sheet may be needed for the same student; therefore I would need the data from the "attendance column" from the second sheet ( and perhaps the 3rd and 4th aswell) to be added on the "absences field" in the first sheet
    My idea: everytime that the short date is inputted in the first line (next to A) in the "Date" column of one of the 4 sheets then we check the 16 Combo box of the attendance column in this sheet instead to check 16*4=64 fields fot the 4 sheets in one go?
    but I don't know at all how to write it in Javascript. Or perhaps there is a way more easier than that?
    Shall I allocate a value for Absent on the “ export value”?
    In purple
    At present I wrote a simple script which matches the number of lines to the poem selected (Eg.  if I select the poem V.Hugo,  the number "36" will appear next to Number of lines).
    Again I would like the make the life of the students very easy so I would like a script which detects this number “36” on the "From .. to …" column,  as soon it is detected (on the first sheet or 2nd or 3rd or 4th)  check from the same line if "A / Pass" or "B / Pass" have been selected in the "Grade" column ,if yes the short date inputted on this line will be written on the field next to "Date finished" .
    this is a simple example with 36 lines only but somethimes, the students may have to memorise 80 lines and more, this is the reason for having 4 sheets in total.
    So basically I would like to automate the field next to" Date finished:" with a script that collect the short date from the day in which the student has finished his memorisation with "A / Pass" or "B / Pass"
    As for the "Total time spent" George Johnson helped me with a script that calculate the difference betwen date started and date finished (thank you)
    I am sollicting your help, because after trying for hours I was really confused with the different if/else needed. And in top of that, it’s my first experience with Javascript.
    I anticipate your assistance, thanking you in advance.

    I found this for counting the absences, its give you the total that's perfect, but is there a better methode which avoid me to write all the fields name, more simple????
    ( I found the idea here : Re: Total number added automatically  )
    // custom calculation script for field "Total #"
    function CountFields(aFields) {
    var nFields = 0;
    for(i = 0; i < aFields.length; i++) {
    try {
    // count null values, export value of Absence is 0;
    if(this.getField(aFields[i]).value == "0") nFields++;
    } catch(e) {
    if(e['message'] == "this.getField(aFields[i]) has no properties") app.alert("unknown field name: " + aFields[i]);
    else app.alert(e.toString());
    } // end catch
    } // end for aFields
    return nFields;
    // create array of field names to count
    var aNames = new Array("Sheet1AttendanceA","Sheet1AttendanceB","Sheet1AttendanceC","Sheet1AttendanceD","Sh eet1AttendanceE","Sheet1AttendanceF",
    "Sheet1AttendanceG","Sheet1AttendanceH","Sheet1AttendanceI","Sheet1AttendanceJ","Sheet1Att endanceK","Sheet1AttendanceL",
    "Sheet1AttendanceM","Sheet1AttendanceN","Sheet1AttendanceO","Sheet1AttendanceP" );
    // count the non-null fields;
    event.value = CountFields(aNames);
    As for the 2nd question, I've tried to do something similar to the previous script, but of course it doesn't work, but I am quite sure that the idea is similar:
    I don't know also how to add the other condition: the student should get A / Pass or B / Pass in order to consider he has finished??? and also how to check these condition from page 2, 3 and 4 and collect the date
    function Datefinished(bFields) {
    d2.value = nFields[i].value;
    for(i = 0; i < aFields.length; i++) {
    try {
    if(this.getField(aFields[i]).value == this.getField("NumberLines").value) d2.value = nFields[i].value;
    } catch(e) {
    if(e['message'] == "this.getField(aFields[i]) has no properties") app.alert("unknown field name: " + aFields[i]);
    else app.alert(e.toString());
    } // end catch
    } // end for aFields
    return nFields;
    // create array of field names to check
    var aNames = new Array("Texte00","Texte54","Texte56","Texte58","Texte60","Texte62","Texte64","Texte66","Te xte68","Texte70","Texte72","Texte74","Texte76","Texte78","Texte80","Texte82");
    var bNames = new Array("d1","d3","d4","d5","d6","d7","d8","d9","d10","d11","d12","d13","d14 ","d15","d16","d17");   // d1 is included because in some cases a student can finish in 1 day (short text);

  • Setting column for filter function

    I've got the following code working for filtering data in a
    grid, but it's currently hard-coded to only filter on the
    "Character" column. (see the searchData function) I'm capturing the
    string for the column that should be searched in the filterColumn
    variable, but now I'm stuck as to how to 'inject' that string into
    the IF statement of the searchData function. If someone can offer
    an explanation I'd appreciate it.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical"
    creationComplete="init()">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    private function init():void {
    initData();
    setFilterColumn();
    [Bindable]
    private var dataList:ArrayCollection ;
    private function initData():void{
    dataList= new ArrayCollection([
    {character:"Peter Gibbons", actor:"Ron Livingston"},
    {character:"Joanna", actor:"Jennifer Aniston"},
    {character:"Michael Bolton", actor:"David Herman"},
    {character:"Samir Nagheenanajar", actor:"Ajay Naidu"},
    {character:"Lawrence", actor:"Diedrich Bader"},
    {character:"Milton Waddams", actor:"Stephen Root"},
    {character:"Bill Lumbergh", actor:"Gary Cole"},
    {character:"Tom Smykowski", actor:"Richard Riehle"},
    {character:"Anne", actor:"Alexandra Wentworth"},
    {character:"Dom Portwood", actor:"Joe Bays"},
    {character:"Bob Slydell", actor:"John C. McGinley"},
    {character:"Bob Porter", actor:"Paul Wilson"},
    {character:"Nina", actor:"Kinna McInroe"},
    {character:"Brian", actor:"Todd Duffy"},
    {character:"Drew", actor:"Greg Pitts"}
    private function filterData():void{
    dataList.filterFunction = searchData;
    dataList.refresh();
    private function searchData(item:Object):Boolean{
    var isMatch:Boolean = false;
    // character is hard coded below
    if(item.character.toLowerCase().search(filterInput.text.toLowerCase())
    != -1){
    isMatch = true;
    return isMatch;
    private function clearFilter():void{
    dataList.filterFunction = null;
    dataList.refresh();
    filterInput.text = '';
    [Bindable]
    private var filterColumn:String;
    private function setFilterColumn():void {
    filterColumn = columnCombo.selectedItem.value;
    ]]>
    </mx:Script>
    <mx:HBox verticalAlign="middle">
    <mx:Label text="Filter:" />
    <mx:ComboBox id="columnCombo"
    change="setFilterColumn()">
    <mx:dataProvider>
    <mx:ArrayCollection id="views">
    <mx:Object label="Character" value="character" />
    <mx:Object label="Actor" value="actor" />
    </mx:ArrayCollection>
    </mx:dataProvider>
    </mx:ComboBox>
    <mx:TextInput id="filterInput" change="filterData()"
    />
    <mx:Button label="Clear" click="clearFilter()" />
    </mx:HBox>
    <mx:DataGrid dataProvider="{dataList}" width="400"
    height="400">
    <mx:columns>
    <mx:DataGridColumn headerText="Character"
    dataField="character" />
    <mx:DataGridColumn headerText="Actor" dataField="actor"
    />
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>

    Josh Johnson a écrit :
    > That definitely took me another step. To fit my
    previously posted code, I
    > edited your suggestion to this:
    >
    > public function searchData(item:Object):Boolean {
    > var isMatch:Boolean=false;
    > var pattern:RegExp = new
    RegExp("^"+filterInput.text,"i");
    > if (!item[String(columnCombo.selectedItem.value)].length
    ||
    >
    item[String(columnCombo.selectedItem.value)].match(pattern))
    > isMatch=true;
    > return isMatch;
    > }
    >
    > This now works as advertised apart from one bug. It only
    does matches to the
    > beginning of the strings. (i.e if I type in "eter" it
    wouldn't return "Peter
    > Gibbons" through the filter.)
    >
    Just remove anchor 'start of string' from the regexp ("^").
    new RegExp(filterInput.text,"i");

  • Using the result of a function, inside a subselect

    Hi!
    I´m wondering if it´s possible to use the result of a function inside a subselect. Let me give you an example of what I´m trying to do here:
    select * from t_node where node_pk in (get_node_parents_pk(22345));
    The function get_node_parents_pk stands in for the following SELECT-statment:
    select node_pk from t_node_child where parent_node_pk = 12345
    The statement above would return something like this: 12435,23423,23453,23452
    These values represent the node_pk value for the parent nodes.
    I want the get_node_parents_pk function to return a result set similar to this so that I might call it inside the IN ( ) statement.
    Any clue? =)

    I created a collection type in the database:
    CREATE OR REPLACE TYPE nodes_pk_arr IS TABLE OF INTEGER;
    The function get_node_parents_pk () is made to return the collection type above. However, this does not work. I get the following error message:
    SELECT *
    FROM t_node
    WHERE node_pk IN
    (SELECT * FROM TABLE (get_node_parents_pk (22345)));
    ORA-22905: cannot access rows from a non-nested table item
    However, if I insert a nodes_pk_arr collection directly into the SQL-statement, like I do below, it works:
    SELECT *
    FROM t_node
    WHERE node_pk IN
    (SELECT * FROM TABLE (nodes_pk_arr(24564,23545,34523));
    So, when returning the collection from the function I´m told that the collection is not a nested table, when in fact it is. What gives?
    Also, is there no way to return a result set directly from the get_node_parents_pk() function, making it possible to write the statement like that shown below?
    SELECT *
    FROM t_node
    WHERE node_pk IN (get_node_parents_pk (22345));
    Your reply is much appreciated!
    Kind regards
    Robert

Maybe you are looking for

  • How can I turn my ipod on remotely so that I can use the Find my Iphone app (sound mode) to find it

    I have a ipod 5 gen and I lost it somewhere around the house. I've used the Find My Iphone app, but it indicates that its offline. So I'm guessing it ran out of battey or its turned off. That's why I am asking if theres anyway that I could turn my ip

  • Custom clearing MIRO

    All Experts, In Purchase order i have maintained total 20 conditions out of which 7 are custom conditions. Now while doing custom clearing miro, only those 7 conditions ( JCDB,JCV1,JECV,J1CV,JEDB,JADC,JSDB ) are displayed ? Why and How ? And every ti

  • Help "greping" modules?

    Hey i need to grep some  modules form my ubuntu partition to get them for my arch I know wifi is # dmesg|grep iwl i need keyboard , touchpad and video driver any one who can help me?

  • Can I force video to remain vertical as I edit?

    So, I am doing a couple of iPhone screencast tutorials, and since most of the audience will actually just watch this on their iPhone, I wanted to leave the video vertical as-is and simply add in some audio on top, which I've got all set in iMovie for

  • Posting of sale base item

    when i post sale base item to gl the period for which it is port is not show in fbl5n customer line item how it possible to see period in line item also Nutan