Sum function Returning Count

Post Author: RobCote
CA Forum: Formula
Any ideas why the Sum/Ag/Max functions would be returning the count of a row that has a decimal in the Field I'm trying to sum?

Post Author: V361
CA Forum: Formula
does cr think the field is text ?,  if so, you may need to use a formula to convert to a number, and then sum off the formula.

Similar Messages

  • COUNT() and SUM() function it not working in XDO file.

    Hi ,
    I am getting one error. Count and sum function not working proper.
    For example :
    Department 10 have 3 employee and total salary is 8750. But my report returning total employee 1 and total salary 5000
    10
    Ename Sal
    KING 5000
    CLARK 2450
    MILLER 1300
    ==================
    total employee : 1
    total salary : 5000
    Kindly help me solve this problem.
    <dataTemplate name="TEXT">
    <properties>
    <property value="upper" name="xml_tag_case" />
    </properties>
    <lexicals>
    </lexicals>
    <dataQuery>
    <sqlstatement name="Q_TEMP">
    <![CDATA[SELECT DEPTNO,DNAME,LOC FROM DEPT]]>
    </sqlstatement>
    <sqlstatement name="Q_TEMP1">
    <![CDATA[SELECT ENAME,HIREDATE,SAL FROM EMP WHERE DEPTNO = :DEPTNO]]>
    </sqlstatement>
    </dataQuery>
    <datastructure>
    <GROUP name="G_1" source="Q_TEMP">
    <element value="DEPTNO" name="DEPTNO" />
    <element value="DNAME" name="DNAME" />
    <element value="LOC" name="LOC" />
    <GROUP name="G_2" source="Q_TEMP1">
    <element value="ENAME" name="ENAME" />
    <element value="SAL" name="SAL" />
    <element value="G_2.ENAME" name="TOTL_DETAILS" dataType="number" function="COUNT()" />
    <element value="G_2.SAL" name="TOTL_SAL" function="SUM()"/>
    </GROUP>
    </GROUP>
    </datastructure>
    </dataTemplate>
    Thanks
    Yudhi

    Please have the data structure as below:
    <datastructure>
    <GROUP name="G_1" source="Q_TEMP">
    <element value="DEPTNO" name="DEPTNO" />
    <element value="DNAME" name="DNAME" />
    <element value="LOC" name="LOC" />
    <GROUP name="G_2" source="Q_TEMP1">
    <element value="ENAME" name="ENAME" />
    <element value="SAL" name="SAL" />
    *</GROUP>*
    *<element value="G_2.ENAME" name="TOTL_DETAILS" dataType="number" function="COUNT()" />*
    *<element value="G_2.SAL" name="TOTL_SAL" function="SUM()"/>*
    *</GROUP>*
    </datastructure>
    Aggregate functions to be placed at the level you require it. Here you need at G_1, so place it there.

  • Sum() function not working properly. Instead of summing, its showing total count of the rows

    We have migrated one application from .net framework 1.0 to .net framework  2 (from Visual studio 2003 to Visual STUDIO 2005). Now after migration we are facing some problem related to the sum function in Crystal report 10. It is not working properly.
    So we migrated to Crystal report XI release 2 (though still using evaluation version for testing purpose), the problem is not yet resolved.
    The problem we are facing is while using the summary in the group field, it is showing the number of rows instead of the sum of the values.
    We have checked the same with min-max functions, and it is working properly with those.
    We have tried to make the sum by formula field. In such case, it is not showing any syntactical error but at execution time, it is throwing an error saying "A number field or currency amount field is required here".
    In the  the report the datatype of the field on which we are applying the sum function, is number, and in the table from where the data is fetched, the datatype is numeric(9,6).
    Any idea why sum function is not working ?
    I was browsing the net and saw running totals can be a work around for such summation issues in Crystal Report XI.
    Can you please provide insight of how to implement running totals for summation purpose in solving such issues.

    Hi,
    Running totals are more accurate than Summary Totals in Crystal.  Why? ...ask Crystal.  Anyway, just right click on Running Totals, create a new one, and enter you fields, etc. For group totals, it gives you a place to reset the totals for each group, etc.  Pretty self explainatory. 
    Jim

  • Sum function not working properly in Crystal XI. Its showing total count of the values

    We have migrated one application from .net framework 1.0 to .net framework  2 (from Visual studio 2003 to Visual STUDIO 2005). Now after migration we are facing some problem related to the sum function in Crystal report 10. It is not working properly.
    So we migrated to Crystal report XI release 2 (though still using evaluation version for testing purpose), the problem is not yet resolved.
    The problem we are facing is while using the summary in the group field, it is showing the number of rows instead of the sum of the values.
    We have checked the same with min-max functions, and it is working properly with those.
    We have tried to make the sum by formula field. In such case, it is not showing any syntactical error but at execution time, it is throwing an error saying "A number field or currency amount field is required here".
    In the  the report the datatype of the field on which we are applying the sum function, is number, and in the table from where the data is fetched, the datatype is numeric(9,6).
    Any idea why sum function is not working ?
    I was browsing the net and saw running totals can be a work around for such summation issues in Crystal Report XI.
    Can you please provide insight of how to implement running totals for summation purpose in solving such issues.

    Are you seeing this happen in the Crystal designer as well, outside of any .NET application?

  • Why does the sum function not work when I try to add a column of decimal numbers?  The value is always returned as 0.  No problem with whole numbers but decimals do not work!

    just bought a MacBook Air and using Numbers to make a spreadsheet for financial purposes.  The sum function is working ok for whole numbers but when I try to sum a column of 2 decimal place numbers the result always comes back as 0.  Can anyone help?

    Hi laura,
    I suspect that your 2 decimal place numbers are formatted as text. Change the format of the column to currency and see it that works.
    Also You might want to update your profile to reflect your current systems!
    quinn

  • Function returning a query

    Hi guys,
    A query suddenly became very slow & has remained like it while connecting over a database. I assume the reason is because the data is being retrieved from 6 tables across a link (6 different connections to the same database) so I thought a view should be better as I had a similar issue and this seemed to resolve it. However I then thought that perhaps a function returning the results would be faster as it would mean I could include the where clauses & group by clause to be done remotely on the database rather than locally after much more rows were returned...is this assumption correct?
    My query is as follows:
    select     rpad(username,18) user_name, rpad(terminal,18) terminal_id, rpad(userhost,30) host_name, 
               action_name, count(*) actions, sum(sessioncpu) session_cpu
    from
    select     username,
       terminal,
       userhost,
       action_name,
       to_char(timestamp,'DD/MM/YYYY HH24:MI:SS') timestamp,
       logoff_time,
       returncode, session_cpu sessioncpu
    from       dba_audit_session@XXX
    where (logoff_time >= sysdate - :P1_RAD
    AND :P1_RAD IS NOT NULL AND :P1_RAD != -1
    AND :REQUEST != 'But')
    OR (logoff_time >= to_TIMESTAMP(TO_DATE(:P1_FROM, 'DD-MON-YY') || ' ' || :P1_FROM_HOUR, 'DD-MON-YY HH24:MI:SS')
    AND logoff_time < to_TIMESTAMP(TO_DATE(:P1_TO, 'DD-MON-YY') || ' ' || :P1_TO_HOUR, 'DD-MON-YY HH24:MI:SS')
    AND :REQUEST = 'But'
    AND :P1_FROM IS NOT NULL AND :P1_TO IS NOT NULL)
    union
    select username,
            terminal,
       userhost,
       action_name,
       to_char(timestamp,'DD/MM/YYYY HH24:MI:SS') timestamp,
       logoff_time,
       returncode, sessioncpu
    from
    select
           userid            USERNAME ,
           userhost          USERHOST ,
           terminal          TERMINAL ,
           cast (
               (from_tz(ntimestamp#,'00:00') at local) as date) timestamp,
           act.name          ACTION_NAME ,         
           logoff$time logoff_time      /* LOGOFF_TIME   */,
           sessionid         /* SESSIONID */,
           returncode        /* RETURNCODE */,      
           sessioncpu        /* SESSION_CPU */      
    from sys.aud_archive@XXX aud, system_privilege_map@XXX spm, system_privilege_map@XXX spx,
         STMT_AUDIT_OPTION_MAP@XXX aom, audit_actions@XXX act
    where   aud.action#     = act.action    (+)
      and - aud.logoff$dead = spm.privilege (+)
      and   aud.logoff$dead = aom.option#   (+)
      and - aud.priv$used   = spx.privilege (+)
    and act.action between 100 and 102
    where (logoff_time >= sysdate - :P1_rad
    AND :P1_RAD IS NOT NULL AND :P1_RAD != -1
    AND :REQUEST != 'But')
    OR (logoff_time >= to_TIMESTAMP(TO_DATE(:P1_FROM, 'DD-MON-YY') || ' ' || :P1_FROM_HOUR, 'DD-MON-YY HH24:MI:SS')
    AND logoff_time < to_TIMESTAMP(TO_DATE(:P1_TO, 'DD-MON-YY') || ' ' || :P1_TO_HOUR, 'DD-MON-YY HH24:MI:SS')
    AND :REQUEST = 'But'
    AND :P1_FROM IS NOT NULL AND :P1_TO IS NOT NULL)
    group by username,   terminal,   userhost,    action_name
    order by actions desc;So it would take 6 parameters (p1_rad, request, p1_from, p1_to, p1_from_hour, p1_to_hour) and return a table with 8 columns. Would the WHERE & GROUP BY clauses being done remotely rather than on APEX be much better?
    Mike

    In general functions don't help much to increase the performance.
    However sometimes you can programatically choose different select statements depending whether a parameter is filled by the user or not. This allows you as a programmer to provide different and optimized statements depening on the input conditions.
    simplified pseudocode example
    "SELECT"
    select *
    from myTable
    where (column1 = :param1 or :param1 is null); /* problematic to get an index scon on column1 for this OR expression */
    "PL/SQL"
    if :param1 is null then
      select *
      bulk collect into ...
      from myTable; /* Full table scan will be used */
    else
      select *
      bulk collect into ...
      from myTable
      where column1 = :param1; /* index scan on column1 can be used, column historgrams will be considered */
    end if;

  • SUM function to give NULL result

    I am really lost on how I can force the SUM function to give me a NULL result when at least one of the elements is a NULL value. I would appreciate any help.

    The short answer is "you can't". The slightly longer answer is the you can't because most aggregate functions work only on non-null values, so SUM silently ignores NULLS.
    However, you can take advantage of that fact to do what you want.
    SQL> SELECT * FROM t;
            ID GROUPCOL
            33 GROUPA
            50 GROUPA
             5 GROUPA
            21 GROUPA
            43 GROUPA
            58 GROUPB
            10 GROUPB
            29 GROUPB
            10 GROUPB
            37 GROUPB
               GROUPA
    SQL> SELECT groupcol, SUM(id) sum_id, COUNT(*) count_all,
      2               COUNT(id) count_id
      3        FROM t
      4        GROUP BY groupcol;
    GROUPCOL       SUM_ID  COUNT_ALL   COUNT_ID
    GROUPA            152          6          5
    GROUPB            144          5          5Note that count_all is different than count_id. So, we can wrap this query in another to return NULL for the sum of groupa.
    SQL> SELECT groupcol, CASE WHEN count_all = count_id THEN sum_id
      2                        ELSE NULL END sum_id
      3  FROM (SELECT groupcol, SUM(id) sum_id, COUNT(*) count_all,
      4               COUNT(id) count_id
      5        FROM t
      6        GROUP BY groupcol);
    GROUPCOL       SUM_ID
    GROUPA
    GROUPB            144Although, I too would be interested in the answer to 405764's question.
    John

  • Error when using SUM function in Excel template

    I am trying to use the XDO_METADATA to create a sum of a column from my XML data and I am getting the following error in the Template Viewer:
    [111412_104246459][][PROCEDURE] Log Level is changed to PROCEDURE
    [111412_104246553][oracle.xdo.common.xml.XSLTWrapper][ERROR] XSL error:
    Time: 0.125 sec.
    FO Formatting failed.
    <Line 317, Column 116>: XML-23029: (Error) FORG0001: invalid value for cast/constructor
    @Line 317 ==> <Cell Index="2" Style="R7C3" Field="XDO_?SUM_V_CR_MO_IDD1?"><xsl:value-of select="sum(.//G_CR_MST_D/V_CR_MO_IDD)"/>
    when I use:
    XDO_?SUM_V_CR_MO_IDD1?     <?sum(.//G_CR_MST_D/V_CR_MO_IDD)?>
    or
    [111412_104048508][][PROCEDURE] Log Level is changed to PROCEDURE
    [111412_104048554][oracle.xdo.common.xml.XSLTWrapper][ERROR] XSL error:
    Time: 0.078 sec.
    FO Formatting failed.
    <Line 317, Column 105>: XML-23029: (Error) FORG0001: invalid value for cast/constructor
    @Line 317 ==> <Cell Index="2" Style="R7C3" Field="XDO_?SUM_V_CR_MO_IDD1?"><xsl:value-of select="sum(.//V_CR_MO_IDD)"/>
    when I use:
    XDO_?SUM_V_CR_MO_IDD1?     <?sum(.//V_CR_MO_IDD)?>
    I believe the XSL to be correct because when I change it to a count it works and when I go into BI Publisher 11g and create the query in the data model and then create a summary from it, the summary is created.
    Can anyone help?

    I went back to basics and created reports (via EXCEL templates) like I was asking based on good old EMP and DEPT and I found exactly the same problems I was mentioning. I looked at the templates provided but they were not calculating totals, like me they were selecting them and then just displaying them on the page.
    Anyway, I have narrowed it down to the fact that when you do aggregates like sum(.//SAL) this works if you have a salary for every value. I did an outer join with DEPT so I did have empty rows and why I still experienced the problems.
    Basically XSL does not like adding (including using the sum function) values that effectively have nulls in them which is why I get the cast/constructor errors because it is trying to turn a NaN value to a number and does not (or cannot) do it.
    You need to either have a value in every row of your column (maybe possible by selecting nvl in your query) and make sure that you check the "create empty nodes" checkbox in the data model of BI Publisher.,
    the other solution is an xsl solution where you would have to make sure that you only added non null values and for that you would have to investigate xsl blogs.
    It is, by the way, why my count worked because it is just counting that the record exists it does not care what the element content is or isn't.
    Closing thread.

  • Issues using SUM Function in query

    I have pasted two queries Query1 (calculating counts for total_ships and ships_released) and Query2 (calculating the two same counts and then calculating SUM for total_shipments and I am having problem in this)
    Query 1:
    select  b.loc , b.week, b.vvalue2, b.Total_ships, nvl(a.up_date,'None') as datee , nvl( a.ships_rel_total,0) as Total_released
    from (
          SELECT l.loc  , sr1.vvalue1 as Week, sr.vvalue2 , to_char(ss.udate, 'YYYY-MM-DD') as up_date ,  count(distinct s.ship_id ) as ships_rel_total
          FROM ship s, loct l,
             ship_num sr1,  ship_num sr, ship_stat ss, ship_stat ss1
          WHERE ......
          Group by l.loc , sr1.vvalue1, sr.vvalue2 , to_char(ss.udate, 'YYYY-MM-DD')
          ) A,
    ( SELECT distinct l.loc  , sr1.vvalue1 as Week, sr.vvalue2 , count(s.ship_id ) as Total_Ships
          FROM ship s, loct l,
              ship_num sr1,  ship_num sr, ship_stat ss, ship_stat ss1
          WHERE ......
          Group by c.loc , c.week , c.vvalue2  ) B
    where a.loc (+) = b.loc
    and a.vvalue2  (+) = b.vvalue2
    order by b.loc, b.week , b.vvalue2,a.up_date; Query 1 Output:
    *OUTPUT*
    LOC         WEEK          VALUE2        TOTAL_SHIPS       DATEE         TOtAL_SHIPS_RELEASED
    AA          111              BB              12                  10-05-12            2
    AA          111              BB              12                  11-05-12            4
    AA          111              CC              2                    14-05-12            1Then I added sum function for total_ships and its not giving me result what I need :(
    Query 2:
    select  b.loc , b.week, b.vvalue2, b.sum_ships, nvl(a.up_date,'None') as datee , nvl( a.ships_rel_total,0) as Total_released
    from (
          SELECT l.loc  , sr1.vvalue1 as Week, sr.vvalue2 , to_char(ss.udate, 'YYYY-MM-DD') as up_date ,  count(distinct s.ship_id ) as ships_rel_total
          FROM ship s, loct l,
             ship_num sr1,  ship_num sr, ship_stat ss, ship_stat ss1
          WHERE ......
          Group by l.loc , sr1.vvalue1, sr.vvalue2 , to_char(ss.udate, 'YYYY-MM-DD')
    ) A,
    ( Select  c.loc, c.week , c.vvalue2 ,  sum(c.total_ships) sum_ships 
    from
        ( SELECT distinct l.loc  , sr1.vvalue1 as Week, sr.vvalue2 , count(s.ship_id ) as Total_Ships
          FROM ship s, loct l,
              ship_num sr1,  ship_num sr, ship_stat ss, ship_stat ss1
          WHERE ......
          Group by l.loc , sr1.vvalue1 , sr.vvalue2  ) C
    Group by c.loc , c.week , c.vvalue2  ) B
    where a.loc (+) = b.loc
    and a.vvalue2  (+) = b.vvalue2
    order by b.loc, b.week , b.vvalue2,a.up_date;  my query is giving me this :(
    Query 2 Output:
    LOC         WEEK          VALUE2        *SUM_SHIPS*       DATEE         TOtAL_SHIPS_RELEASED
    AA          111                BB              26                 10-05-12            2
    AA          111                BB              26                 11-05-12            4
    AA          111                CC              26                 14-05-12            1
    But I need a result like this:
    LOC         WEEK          VALUE2        SUM_SHIPS       DATEE         TOtAL_SHIPS_RELEASED
    AA          111                BB              14              10-05-12            2
    AA          111                BB              14              11-05-12            4
    AA          111                CC              14              14-05-12            1

    Hi,
    It sounds like you have a Fan Trap , where a one-to-many relationship is causing some items to be counted many times.
    The usual solution is to compute the aggregates before doing the one-to-many join. Analytic functions may make this simpler.
    Sorry, I can't show you exactly how to do it without the exact data.
    Post CREATE TABLE and INSERT statements for all tables involved, and also post the results you want from that data (if different from what you've already posted).
    Explain, using specific examples, how you get those results from that data.
    Simplify the problem as much as possible. If the problem only concerns the total_ships column, then only post the data needed to compute total_ships. This includes all the columns involved in the joins and GROUP BY clauses.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

  • Function returning error - change notification

    I have a function returning error text. When error occurs I get the message
    'xx error has occurred' on the screen (in notification). Is there a way to control the message text so I can display different text?

    It's something like this:
    DECLARE l_code zip.code%TYPE;
    got_error varchar2(1) := 'N';
    l_check_fld varchar2(30000);
    l_error_fld varchar2(32000);
    vErrorFields varchar2(1000);
    CURSOR check_zip IS
    select ''
    from zip
    where code = l_code;
    BEGIN
    apex_collection.create_or_truncate_collection('ZIP');
    FOR i IN 1 .. apex_application.g_f03.COUNT LOOP
    vErrorFields := '';
    /* Code MUST be entered */
    if (apex_application.g_f03(i) is null and
    (apex_application.g_f04(i) is not null or
    apex_application.g_f05(i) is not null))then
    got_error := 'Y';
    vErrorFields := vErrorFields || ',f03';
    l_error_fld := l_error_fld || 'Row ' || to_char(i) || ':' ||' <span style="color: red">Code cannot be <strong>blank.</strong></span><br>';
    end if;
    END LOOP;
    if got_error = 'N' then
    apex_collection.delete_collection('ZIP');
    end if;
    RETURN l_error_fld;
    END;

  • Why does getdate() function return same time value for multiple select statements executed sequentially

    When I run the following code
    set nocount on
    declare @i table(id int identity(1,1) primary key, sDate datetime)
    while((select count(*) from @i)<10000)
    begin
    insert into @i(sDate) select getdate()
    end
    select top 5 sDate, count(id) selectCalls
    from @i
    group by sDate
    order by count(id) desc
    I get the following results. 
    sDate                   selectCalls
    2014-07-30 14:50:27.510 406
    2014-07-30 14:50:27.527 274
    2014-07-30 14:50:27.540 219
    2014-07-30 14:50:27.557 195
    2014-07-30 14:50:27.573 170
    As you can see the select getdate() function returned same time up to the milisecon 406 time for the first date value.  This started happening when we moved our applications to a faster server with four processors.  Is this correct or am I
    going crazy?
    Please let me know
    Bilal

    Observe that adding 2 ms is accurate only with datetime2.  As noted above, datetime does not have ms resolution:
    set nocount on
    declare @d datetime, @i int, @d2 datetime2
    select @d = getdate(), @i = 0, @d2 = sysdatetime()
    while(@i<10)
    begin
    select @d2, @d, current_timestamp, getdate(), sysdatetime()
    select @d = dateadd(ms,2,@d), @i = @i+1, @d2=dateadd(ms,2,@d2)
    end
    2014-08-09 08:36:11.1700395 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1720395 2014-08-09 08:36:11.173 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1740395 2014-08-09 08:36:11.177 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1760395 2014-08-09 08:36:11.180 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1780395 2014-08-09 08:36:11.183 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1800395 2014-08-09 08:36:11.187 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    DATE/TIME functions:
    http://www.sqlusa.com/bestpractices/datetimeconversion/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • How to use Groovy sum function in JDev11g

    In Fusion developer guide: 3.6 Overview of Groovy Support
    Says you can use the following built-in aggregate functions on ADF RowSet objects:
    ■ rowSetAttr.sum(GroovyExpr)
    ■ rowSetAttr.count(GroovyExpr)
    ■ rowSetAttr.avg(GroovyExpr)
    ■ rowSetAttr.min(GroovyExpr)
    ■ rowSetAttr.max(GroovyExpr)
    Have see a couple of threads that deal with this topic but neither say how to explicitly do this.
    I created a VO (EmpView1) and added a transient variable empSum, and set it to the expression EmpView1.sum("Sal") also rowSetAttr.sum("Sal") and get the following error.
    (oracle.jbo.expr.JIEvalException) JBO-25077: Name EmpView1 not found in the given object: ViewRow [oracle.jbo.Key[7839 ]].
    Really do need to find out how to use these functions.
    Thanks - Casey

    Hi,
    here's a little tutorial
    - create a master/detail relation between Departments and Employees using the HR schema
    - For the Departments VO, create a RowImpl class from the Java section
    - create an attribute SumFromEO in the Departments EO
    - in the DepartmentsVO, create a new attribute from EO pointing to SumFromEO
    - Also, in the VO, create a new attribute SumFromVO
    - make sure the attribue is transiesnt
    - set the created attribute on the VO "SumFromVO" and "SumFromEO" to use an Expression
    - Add the following Groovy expression to the SumFromEO transient attribute on the EO
    adf.object.Employees1.sum("Salary");
    - Add the following Groovy expression to the SumFromVO transient attribute on the VO
    adf.object.EmployeesView.sum("Salary");
    When you run this then both, the EO based VO attribute and the VO attribute should show the same value
    Frank

  • Function returning SQL query for mutiple series in a chart

    Hi,
    I would like to know if there is a way to specify a single PL/SQL function returning the queries for multiple series in a 2D Line Flash Chart. I have multiple series in my chart that has different values in the where clause. I can write a PL/SQL function that can return all these queries in one shot. Is there anyway that I can specify this function as returning the queries for all the series in the chart?
    As an example, assume that I am using the following three queries for the series in my chart:
    select deptno, count(*) from emp where deptno = 10 group by deptno
    select deptno, count(*) from emp where deptno = 20 group by deptno
    select deptno, count(*) from emp where deptno = 30 group by deptno
    I can't write a PL/SQL function that returns a query in the multiple series syntax (SELECT link, label, series_1_value [, series_2_value [, ...]]FROM ...) as I am using an aggregate function and my where clause is different for each series.
    Thanks,
    Rupesh

    Hi Roel,
    Thanks for your reply. I am already using an analytical function (RATIO_TO_REPORT(COUNT(*)) OVER () ) in my actual report. My problem is that the query for one series differs from the other only in one where clause. I will be able to dynamically able to generate all the queries for all the series in one pl/sql function. But the chart definition screen does not allow us to define a single function that returns queries for the all the series - possibly seperated by some seperator like S1: select.... S2:select and so on.
    Regards,
    Rupesh

  • Oracle 11g Table function returns no records on first call

    Hello,
    On a Oracle 11g R2 I've a table function ( PIPELINED ) returning rows selected from a table.
    The first time the function is selected, in a session ( I've tried to disconnect and log in again ), it returns no rows.
    I've tried to log the call using DBMS_OUTPUT and from what I see the select on the table function returns no rows and no output is printed. So I presume Oracle is not calling the function.
    The same function on a similar environment ( same db versions, patches and database structure ) works fine. The second environment is a production environment so it has more memory and some other settings enabled.
    Does anyone know of settings that can relate to this behaviour ?
    Thanks in advance for the help.
    Regards,
    Stefano Muret

    Thank you for answering so fast.
    Here's the function code:
    FUNCTION template_parameters (iTemplate IN TEMPLATE_RAW_DATA.TMPL_ID%TYPE := NULL)
    RETURN table_type_tmpl_parameters PIPELINED
    IS
    li_exception INTEGER DEFAULT -20025;
    POUT_PARM TABLE_TYPE_TMPL_PARAMETERS;
    lt_parms table_type_tmpl_parms_raw;
    sParmCheck VARCHAR2(4000);
    iOccurrence INTEGER;
    BEGIN
    pOut_Parm := table_type_tmpl_parameters();
    pOut_Parm.EXTEND;
    select
    tmpl_id
    *,tmpl_name*
    *,replace(upper(trim(sql_out)),'[SCHEMA].')*
    *,UPPER(TRIM(out_tmpl_parms))*
    bulk collect into lt_parms
    from ref_templates
    where tmpl_id = NVL(iTemplate,tmpl_id)
    order by tmpl_id;
    FOR k IN 1..lt_parms.COUNT
    LOOP
    pOut_Parm(1).tmpl_id := lt_parms(k).tmpl_id;
    pOut_Parm(1).tmpl_name := lt_parms(k).tmpl_name;
    FOR i IN 1..2
    LOOP
    IF i = 1 THEN
    sParmCheck := lt_parms(k).sql_out;
    ELSE
    sParmCheck := lt_parms(k).sql_parms;
    END IF;
    iOccurrence := 1;
    *pOut_Parm(1).parameter_name := regexp_substr(sParmCheck,'\[[^\[]+\]',1,iOccurrence);*
    WHILE pOut_Parm(1).parameter_name IS NOT NULL
    LOOP
    PIPE ROW (pOut_Parm(1));
    iOccurrence := iOccurrence + 1;
    *pOut_Parm(1).parameter_name := regexp_substr(sParmCheck,'\[[^\[]+\]',1,iOccurrence);*
    END LOOP;
    END LOOP;
    END LOOP;
    RETURN;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(li_exception,SUBSTR(SQLERRM,1,1000));
    RETURN;
    END template_parameters;
    This function is part of a package.
    The data on both environments is the same.

  • How to correct XML Output in Cross Tab Template for sum function?

    I have designed a Cross Tab Template to summarize R12 Account Analysis data by Period by Party_name. The template is doing what I want it to do with the exception of amount. I have a function in the sum(accounted_net) field and it will only display 0.00 even though I know there are actual amount. Can someone help in looking at my template to see what I have done wrong?
    Here is the sum funciton.
    <?if:count(current-group()[CCID_SOURCE=$ABC])?><?sum(current-group()[CCID_SOURCE=$ABC]/ACCOUNTED_NET)?> <?end if?>
    CCID_SOURCE is an element I created in XML to concatnate CCID and Party_name for grouping. $ABC is a variable that I defined for "CCID_SOURCE" to check if there is null value for a specific ccid_party. If it's null, it won't do the sum function, otherwise it will sum the accounted_net for the period_name, party_name.
    Thank you for your help.
    Stacey

    Figured this out on our own

Maybe you are looking for

  • Creation of Custom Attributes in org structure

    Hi All, I was creating custom attributes that could be displayed in PPOMA_BBP. I tried to create it in table T77omattr, but it doesnot show up in the org plan. Can somebody provide insight on this and let me know what i need to exactly do in order to

  • Help needed in 10gR2 to 11gR2 EBS Database Upgrade

    Hi, I am upgrading EBS Database from 10gR2 (10.2.0.3) to 11gR2 11.2.0.3. While going through Oracle Note Complete Checklist for Manual Upgrades to 11gR2 [ID 837570.1], under the point 3 of "Recommendations from Source database" it says: "Disable the

  • 10.6.8 + Safari 5.1 = freeze

    Hi all. My partner has this problem on her MacBook Pro, which is newer than the one I'm running 10.7 on. Opening Safari led to an immediate freeze: no page would load. I reset Safari, I wiped preferences, I emptied the cache. I reinstalled the OS. Sa

  • How can I get Imovie to recognize clips from my Camcorder

    I have a panasonic HDC-TM700 camcorder I recorded in AVCHD mode and Imovie won't recognize the clips. Does anyone have any tips for converting the clips into a readible format?

  • MS Office documents locking itself when user is trying to save it on a network drive.

    As the subject states I am having a issue with a user that when he is trying to save a document it is stating that the file is in use by another user.... for every single document he tries to save to. I made a test account and assigned it to the same