Can't have aggregate function in WHERE clause clause

Dear all,
I've created object in BO XI 3.1 Designer with following criterias:
http://img4.imageshack.us/img4/833/20111201124314.th.jpg
It is a simple number - 1,2,3,4,5.
Now I need to use this object as a criteria for WHERE function in another object.
http://img607.imageshack.us/img607/1543/20111201124717.th.jpg
I receive an error "Can't have aggregate function in WHERE clause <clause>"
How can I overcome this?
P.S. I'm sorry in advance if such topic already exist - I didn't found one.
Edited by: Ashot Antonyan on Dec 1, 2011 9:50 AM
Edited by: Ashot Antonyan on Dec 1, 2011 9:51 AM

Hi,
You will have to use Sub query to achieve this. Give more details on what is available and what you need then i could help you out with the complete solution.
Thanks,
Ravichandra K

Similar Messages

  • How can I have both functions "Read Only" & "Write" mode on the same form?

    Dear all,
    How can I have both functions "Read Only" & "Write" mode on the same form? Is it possibile for this?
    Please advice,
    Amy

    This is what I use in some dialogs:
    PROCEDURE SET_QUERY_ONLY IS
      -- Procedure Set_query_only
      -- Rend les blocks non modifiables   --
      -- Disable menus Insert/Delete/Clear --
      -- Entree               :
      -- Sortie               :
      -- Ent/Sortie     :
      -- Creation               : FD    10/2003
      -- Modification     : 
         LC$Block     Varchar2(30) ;
    BEGIN
      Set_Menu_Item_Property('Edit.Insert', ENABLED, PROPERTY_FALSE ) ;
      Set_Menu_Item_Property('Edit.Remove', ENABLED, PROPERTY_FALSE ) ;
      Set_Menu_Item_Property('Edit.Clear', ENABLED, PROPERTY_FALSE ) ;
      Set_Menu_Item_Property('Action.Save', ENABLED, PROPERTY_FALSE ) ;
      LC$Block := get_form_property( NAME_IN('System.Current_Form'), FIRST_BLOCK ) ;
      -- Tous les blocs en Query only --
      While LC$Block is not null Loop
           Enable_Block( LC$Block, FALSE ) ;
           LC$Block := get_block_property( LC$Block, NEXTBLOCK ) ;
      End loop ;
    END;
    PROCEDURE ENABLE_BLOCK
              PC$Block in Varchar2,
              PB$Enable in Boolean Default TRUE
         ) IS
      -- Procedure Enable_block
      -- Rend le bloc Enable / Disable --
      -- Entree          : PC$Block (nom du bloc Forms)
      --               : PB$Enable (TRUE ou FALSE)
      -- Sortie          :
      -- Ent/Sortie             :
      -- Creation          : FD    10/2003
      -- Modification     : 
    BEGIN
         If PB$Enable Then
              Set_Block_Property( PC$Block, INSERT_ALLOWED, PROPERTY_TRUE ) ;
              Set_Block_Property( PC$Block, UPDATE_ALLOWED, PROPERTY_TRUE ) ;
              Set_Block_Property( PC$Block, DELETE_ALLOWED, PROPERTY_TRUE ) ;
              Set_Menu_Item_Property('Edit.Insert', ENABLED, PROPERTY_TRUE ) ;
              Set_Menu_Item_Property('Edit.Remove', ENABLED, PROPERTY_TRUE ) ;
              Set_Menu_Item_Property('Edit.Clear', ENABLED, PROPERTY_TRUE ) ;
              Set_Menu_Item_Property('Action.Save', ENABLED, PROPERTY_TRUE ) ;
         Else
              Set_Block_Property( PC$Block, INSERT_ALLOWED, PROPERTY_FALSE ) ;
              Set_Block_Property( PC$Block, UPDATE_ALLOWED, PROPERTY_FALSE ) ;
              Set_Block_Property( PC$Block, DELETE_ALLOWED, PROPERTY_FALSE ) ;
              Set_Menu_Item_Property('Edit.Insert', ENABLED, PROPERTY_FALSE ) ;
              Set_Menu_Item_Property('Edit.Remove', ENABLED, PROPERTY_FALSE ) ;
              Set_Menu_Item_Property('Edit.Clear', ENABLED, PROPERTY_FALSE ) ;
              Set_Menu_Item_Property('Action.Save', ENABLED, PROPERTY_FALSE ) ;
         End if ;
    END;Francois

  • SAP B1- Can we have the functionality of Indent to purchase?

    Dear All,
    Can we have the functionality of Indent to purchase in SAP B1-Client? If yes, kindly let me know the necssary steps.
    Thanks in advance..!
    Regards
    Rounak

    Hi Rounak.....
    This is your duplicated thread with same doubt so please close this one...
    Any ways.....
    Hi Rounak......
    Purchase Indent is not as such there in B1 but you can get it done by having approval procedure on Purchase Order level.
    Purchase before approval is nothing but Indent....
    Regards,
    Rahul

  • How can we use DECODE function in where clause.

    Hi Guys,
    I have to use DECODE function in where clause.
    like below
    select * from tab1,tab2
    where a.tab1 = b.tab2
    and decode(code, 'a','approved')
    in this manner its not accepting?
    Can any one help me on this or any other aproach?
    Thanks
    -LKR

    >
    I am looking for to decode the actual db value something in different for my report.
    like if A then Accepted
    elseif R then Rejected
    elseif D then Denied
    these conditions I have to check in where clause.
    >
    what are you trying to do?
    may be you are looking for
    select * from tab1,tab2
    where a.tab1 = b.tab2
    and
       (decode(:code, 'A','Accepted') = <table_column>
        or
        decode(:code, 'R','Rejected') = <table_column>
       or
        decode(:code, 'D','Denied') = <table_column>
       )

  • User defined function in where IN clause

    Hi,
    I have a Function who returns in priview:
    (1,2,3,4)
    Now i am using this function in SQL where clause
    Select from debug where id in debug.debug_process()
    On execute select i am getiing ORA-01722 invalid number , i understand that functions return not only numbers but  character symbols too '(,)'
    Are it posible to use user defined function who do not return NUMBER in Where clause IN statement ?  If not what tips can sugest me for getting list of values for use in IN Clause?
    ID.
    Thanks!

    Hi,
    Please try:
    You can use SYS REFCURSOR for return your data.
    create or replace function get_debug return sys_refcursor is
         v_rc sys_refcursor;
       begin
         open v_rc for 'select * from debug where id in '|| debug.debug_process();
         return v_rc;
       end;
    Function created.
    Now, if we look at using this through SQL*Plus we first create ourselves a ref cursor variable to accept the results of the function, and then call the function to get the ref cursor back..
    SQL> var rc refcursor
    SQL> exec :rc := get_debug ;
    SQL> print rc;
    Regards
    Mahir M. Quluzade

  • Can you use boolean function in where clause

    Hi,
    I have a boolean function. Is it possible to use it in where clause of query.
    Eg;
    is_prime(13) returns boolean
    select 1 from dual where is_prime(13)

    What about something like this
    Create or replace function boolret(id number) return boolean as
    begin
    If id <10 then
    return true;
    elsif id>10 and id<100 then
    return false;
    else
    return null;
    end if;
    end;
    1 declare
    2 id_cat boolean;
    3 begin
    4 id_cat:= boolret(8);
    5 dbms_output.put_line(id_cat);
    6* end;
    SQL> /
    dbms_output.put_line(id_cat);
    ERROR at line 5:
    ORA-06550: line 5, column 2:
    PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'
    ORA-06550: line 5, column 2:
    PL/SQL: Statement ignored
    It seems PL/Sql doesn't have any datatype like Boolean,But it handles Boolean like datatype.
    Regards
    Raj deep.A

  • Aggregate functions without group by clause

    hi friends,
    i was asked an interesting question by my friend. The question is...
    There is a DEPT table which has dept_no and dept_name. There is an EMP table which has emp_no, emp_name and dept_no.
    My requirement is to get the the dept_no, dept_name and the no. of employees in that department. This should be done without using a group by clause.
    Can anyone of you help me to get a solution for this?

    select distinct emp.deptno,dname
    ,count(*) over(partition by emp.deptno)
    from emp
    ,dept
    where emp.deptno=dept.deptno;
    10     ACCOUNTING     3
    20     RESEARCH     5
    30     SALES     6

  • Can we have javascript function in the HTML header of Page 0

    Hello,
    I want to have a javascript function implemented on page zero, Can anyone help me out with this issue.
    Thanks,
    Orton

    There is no HTML Header on Page Zero. The equivalent would be to use the page template.
    It's also possible to place JavaScript in HTML regions on Page Zero, but I wouldn't consider this a good practice. JavaScript is better kept in external files and referenced using the SRC attribute.

  • Can I have unique function and variable names with createjs when publsihing from Flash?

    Hey everyone!
    I have recently started using the Toolkit for CreateJS exporter for turning small button icon animations, made in Flash, into content for HTML5. I have created 3 seperate icon '.fla' files that animate when rolled over.
    With this example tag added into my html5 document, the animation works fine:
    <canvas id="about_btn" width="85" height="70" style="background-color:#FFF"></canvas>
    However, once I have added more than one canvas tags, only one icon would appear on screen:
    <canvas id="about_btn" width="85" height="70" style="background-color:#FFF"></canvas>
    <canvas id="news_btn" width="85" height="70" style="background-color:#FFF"></canvas>
    <canvas id="contact_btn" width="85" height="70" style="background-color:#FFF"></canvas>
    I found out that the JavaScript files that were generated with each '.fla' file were conflicting because they were all using the same variable and function names (ex. stage, canvas, init(), etc.). Is there a way for me to publish the JavaScript from Flash with document specific variable and function names? (ex. about_stage, about_canvas, about_init())
    A work around methood that I can currently using is putting each <canvas> tag into it's own iFrame.
    Thanks again for the help!
    -DJ

    The JS asset libraries should not conflict with each other, unless there are symbols with the same names. Even then, you can change the Symbols namespace for each FLA to prevent collisions.
    It sounds like you're trying to copy/paste the code out of the preview HTML. It's not really designed for this, and it will lead to name collisions. You'll either want to rewrite this logic in your own HTML (using the preview code as a reference), or rename the variables as appropriate after you copy/paste.
    Best,
    Grant.

  • Can Window and aggregate functions be used in Pro*C?

    Are Window functions like dense_rank() over (partition by ... order by ..) available in Pro*C embedded SQL?
    Thanks
    Rawender Guron

    Please refer to this thread: "Is this forum also used for Pro*'C Questions? "
    Is this forum also used for Pro*'C Questions?

  • Why doesn't PIVOT clause work with COLLECT aggregate function in 11g ?

    Hello all !
    I am really puzzled as to what is considered an aggregate function in the context of the PIVOT clause in 11g.
    I have been toying with quite a few things related to collections lately and this arose as an aside :
    CREATE TABLE TEST_COLL
       NODE_ID    VARCHAR2(15 CHAR) NOT NULL,
       NODE_VALUE VARCHAR2(45 CHAR) NOT NULL,
       NODE_LEVEL NUMBER(1)         NOT NULL
    CREATE OR REPLACE TYPE TREE_NODE AS OBJECT
       NODE_KEY  VARCHAR2( 15 CHAR),
       NODE_NAME VARCHAR2(127 CHAR)
    CREATE OR REPLACE TYPE TREE_NODES AS TABLE OF TREE_NODE NOT NULL;At this stage I am sure we all agree that the query
    SELECT NODE_LEVEL,
           CAST(COLLECT(TREE_NODE(NODE_ID, NODE_VALUE)) AS TREE_NODES) AS NODES
      FROM TEST_COLL
    GROUP BY NODE_LEVEL;is perfectly valid as the COLLECT function is an aggregate function according to the [Official Documentation|http://docs.oracle.com/cd/E11882_01/server.112/e10592/functions031.htm#i1271564]
    But then, one of the following two queries should work
    SELECT CAST(REGION_NODES     AS TREE_NODES) AS REGIONS,
           CAST(DEPARTMENT_NODES AS TREE_NODES) AS DEPARTMENTS,
           CAST(AREA_NODES       AS TREE_NODES) AS AREAS,
           CAST(CENTRE_NODES     AS TREE_NODES) AS CENTRES
      FROM (SELECT NODE_LEVEL, TREE_NODE(NODE_ID, NODE_VALUE) AS NODE
              FROM TREE_COLL
    PIVOT (COLLECT(NODE) FOR NODE_LEVEL IN (1 AS REGION_NODES,
                                             2 AS DEPARTMENT_NODES,
                                             3 AS AREA_NODES,
                                             4 AS CENTRE_NODES
    or (better)
    SELECT REGION_NODES     AS REGIONS,
           DEPARTMENT_NODES AS DEPARTMENTS,
           AREA_NODES       AS AREAS,
           CENTRE_NODES     AS CENTRES
      FROM (SELECT NODE_LEVEL, TREE_NODE(NODE_ID, NODE_VALUE) AS NODE
              FROM TREE_COLL
    PIVOT (CAST(COLLECT(NODE) AS TREE_NODES) FOR NODE_LEVEL IN (1 AS REGION_NODES,
                                                                 2 AS DEPARTMENT_NODES,
                                                                 3 AS AREA_NODES,
                                                                 4 AS CENTRE_NODES
           );yet, both fail with
    ORA-56902: expect aggregate function inside pivot operationInvestigating further, I found the same behaviour when using XMLAGG as the aggregate function in the PIVOT clause.
    Is this normal ? And if it is, is there any other way to achieve the result I was anticipating ?
    My version is
    SQL> SELECT BANNER FROM V$VERSION;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for 64-bit Windows: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - ProductionThanks in advance
    Best Regards
    Philip

    Most likely a bug. But you can bypass it by using any other aggregate making sure group consists of a single row and apply collect to a pivoted value. Yes, the cost is double aggregation. And also there is another cost - you would need to create MAP member function otherwise aggreations like MAX/MIN, etc. will not work:
    CREATE OR REPLACE TYPE TREE_NODE AS OBJECT
       NODE_KEY  VARCHAR2( 15 CHAR),
       NODE_NAME VARCHAR2(127 CHAR),
       map member function f return varchar2
    Type created.
    CREATE OR REPLACE TYPE BODY TREE_NODE AS
      map member function f return varchar2 is
      begin
         return NODE_NAME;
      end f;
    end;
    Type body created.
    CREATE OR REPLACE TYPE TREE_NODES AS TABLE OF TREE_NODE NOT NULL
    Type created.
    SQL> select  *
      2    from  test_coll
      3  /
    NODE_ID NODE_VALUE NODE_LEVEL
    1       A                   1
    2       B                   2
    3       C                   3
    4       D                   4
    5       E                   1
    6       F                   2
    7       G                   3
    8       H                   4
    8 rows selected.
    SQL> Now:
    SELECT CAST(COLLECT(REGION_NODES)     AS TREE_NODES) AS REGIONS,
           CAST(COLLECT(DEPARTMENT_NODES) AS TREE_NODES) AS DEPARTMENTS,
           CAST(COLLECT(AREA_NODES)       AS TREE_NODES) AS AREAS,
           CAST(COLLECT(CENTRE_NODES)     AS TREE_NODES) AS CENTRES
      FROM (
            SELECT  ROWID RID,
                    NODE_LEVEL,
                    TREE_NODE(NODE_ID, NODE_VALUE) AS NODE
              FROM  TEST_COLL
    PIVOT (MAX(NODE) FOR NODE_LEVEL IN (
                                         1 AS REGION_NODES,
                                         2 AS DEPARTMENT_NODES,
                                         3 AS AREA_NODES,
                                         4 AS CENTRE_NODES
    REGIONS(NODE_KEY, NODE_NAME)                         DEPARTMENTS(NODE_KEY, NODE_NAME)                     AREAS(NODE_KEY, NODE_NAME)                           CENTRES(NODE_KEY, NODE_NAME)
    TREE_NODES(TREE_NODE('1', 'A'), TREE_NODE('5', 'E')) TREE_NODES(TREE_NODE('6', 'F'), TREE_NODE('2', 'B')) TREE_NODES(TREE_NODE('7', 'G'), TREE_NODE('3', 'C')) TREE_NODES(TREE_NODE('8', 'H'), TREE_NODE('4', 'D'))
    SQL> SY.

  • Aggregate function using DB adapter

    Is it possible to use aggrgeate functions like count and things like ROWNUM using the DBAdapter wizard in BPEL 10.1.2 ?
    For Example how can I configure a query like
    Select * from emp where ROWNUM<500

    hi all,
    i think there is no way to define external functions like ROWNUM and all in bpel 10.1.2 as we can not write manual sql query in expression block and expression builder don't have aggregate functions .
    But, in 10.1.3 we can write any sql query in expression and it is working fine.
    Is it a bug in 10.1.2?

  • Analytic function and aggregate function

    What are analytic function and aggregate function. What is difference between them?

    hi,
    Analytic Functions :----------
    Analytic functions compute an aggregate value based on a group of rows. They differ from aggregate functions in that they return multiple rows for each group. The group of rows is called a window and is defined by the analytic_clause. For each row, a sliding window of rows is defined. The window determines the range of rows used to perform the calculations for the current row. Window sizes can be based on either a physical number of rows or a logical interval such as time.
    Analytic functions are the last set of operations performed in a query except for the final ORDER BY clause. All joins and all WHERE, GROUP BY, and HAVING clauses are completed before the analytic functions are processed. Therefore, analytic functions can appear only in the select list or ORDER BY clause.
    Analytic functions are commonly used to compute cumulative, moving, centered, and reporting aggregates.
    Aggregate Functions :----------
    Aggregate functions return a single result row based on groups of rows, rather than on single rows. Aggregate functions can appear in select lists and in ORDER BY and HAVING clauses. They are commonly used with the GROUP BY clause in a SELECT statement, where Oracle Database divides the rows of a queried table or view into groups. In a query containing a GROUP BY clause, the elements of the select list can be aggregate functions, GROUP BY expressions, constants, or expressions involving one of these. Oracle applies the aggregate functions to each group of rows and returns a single result row for each group.
    If you omit the GROUP BY clause, then Oracle applies aggregate functions in the select list to all the rows in the queried table or view. You use aggregate functions in the HAVING clause to eliminate groups from the output based on the results of the aggregate functions, rather than on the values of the individual rows of the queried table or view.
    let me know if you are feeling any problem in understanding.
    thanks.
    Edited by: varun4dba on Jan 27, 2011 3:32 PM

  • Aggregate fuction with group by clause

    Hello,
    Following is assignment is given but i dont get correct output 
    so please i am request to all of us write code to solve my problem.
    There can be multiple records for one customer in VBAK tables with different combinations.
    Considering that we do not need details of each sales order,
    use Aggregate functions with GROUP BY clause in SELECT to read the fields.
    <garbled code removed>
    Moderator Message: Please paste the relevant portions of the code
    Edited by: Suhas Saha on Nov 18, 2011 1:48 PM

    So if you need not want all the repeated records, then you select all the values to an Internal table,
    and declare an internal table of same type and Usee COLLECT
    for ex:
    itab1 type  <xxxx>.
    wa_itba like line of itab1.
    itab2 type  <xxxx>. "<-This should be same type of above.
    select * from ..... into table itab1.
    and now...
    loop at itab1 into wa_itab.
    collect wa_itab1 into itab2.
    endloop.
    then you will get your desired result..

  • Aggregate functions in EJBQL ???

    Does the latest version of Oracle App server support aggregate functions like SUM/COUNT/AVG in the EJBQL?

    Does the latest version of Oracle App server support aggregate functions like SUM/COUNT/AVG in the EJBQL? Hi Swami --
    The latest version of Oracle9iAS - v903 is J2EE 1.3 compatible so it supports all of the EJB 2.0 specification.
    The EJB 2.0 specification lists the following functions for EJBQL:
    String Functions:
    CONCAT(String, String) returns a String
    SUBSTRING(String, start, length) returns a String
    LOCATE(String, String [, start]) returns an int
    LENGTH(String) returns an int
    Arithmetic Functions:
    ABS(number) returns a number (int, float, or double)
    SQRT(double) returns a double
    The latest version of the EJB 2.1 specification which will be part of J2EE 1.4, has added support for aggregate functions like orderby, sum, count, etc.
    11.2.7.2 Aggregate Functions in the SELECT Clause
    The result of an EJB QL query may be the result of an aggregate function applied to a path expression.
    The following aggregate functions can be used in the SELECT clause of an EJB QL query: AVG,
    COUNT, MAX, MIN, SUM.
    We will support these when the EJB 2.1 specification is finalized and we produce our J2EE 1.4 compatible implementation.
    cheers
    -steve-

Maybe you are looking for

  • Voice Memos won't save my recordings?

    I'm in college so I usually record my classes for further detailing, but I just recently discovered that Voice Memos just won't save my recordings like 2/5 of the time. I already lost like 4 important ones for the past 3 days. The thing is that I see

  • Report to Identify Parked Invoices and Invoices without PO#

    Experts: Is there a report out there that will provide me 1. All Parked Invoices 2. All Parked Credit Notes 3. All invoices without ref to PO# Thanks! Rahul

  • Can't get MacBook to "see" Airport Extreme

    Last week I bought an Airport Extreme to enable me to direct stream NetFlix on my new Samsung DVD player. To save my life I cannot get my MacBook to recognize the Extreme. I've tried Airport Utility with no luck. I go back to Express and everything i

  • Framework Order PO Invoice to be block if exceeded.

    I am using framework order PO for invoicing planning. The problem is my user can perform invoicing more than total of invoice on PO. Example;- Item: ABC Quantity: 1 Net Price: $10 Invoice planning start from 01.01.2010 until 31.03.2010, this means fo

  • Detect debug mode in runtime?

    During runtime, it is possible from the program itself to detect if it is being run in the java debug mode? Well the idea is that if it is running in the debug mode or release mode I can dynamically load the corresponding debug or release JNI classes