Use of MAX function

Hi,
I am using parent-child hierarchy and in my reports I want to show Max(hierarchy_level). When I use the function MAX directly in the report it works fine in every way. But I want to have this kind of column in the BI Server presentation catalog so the user does not need to add MAX in Analysis/Answers (this is 11g). Normally this would imply a Max(hierarchy_level) as a logical function, but in the BI Server it is not allowed with MAX function in the logical function so it does not work.
The hierarchy level is just a column from a dimension table and creating it as a fact column is not a very good solution. I also tried to solve this in many different ways, but only the MAX funtion in Analysis/Answers allways give the correct result. Used in combination with other dimensions etc. I want the exact same behaviour as I get when using MAX in analysis.
Any good ideas to solve this? Is there another function in the BI Server that works the same way as MAX ?

Very often, about a primary key, see for example our italian accounting application (our VAT invoices:fatture IVA) ), where the holes might be a problem.
Yes Rosario, of course I know that, and that's why I said "in this scenario" : if primary key is the only purpose, I don't think holes could be a problem.
Buona giornata anche a te.

Similar Messages

  • Use of MAX function in Query Designer

    Dear all,
    i want to create a report that gives ONE line per period that holds the MAX of several lines per period. So NO addition of the KF but just one line item.
    I tried to use the MAX function and/or MAX drop-down boxes via properties on KF,
    but they all provide the wrong result (mostly the MAX after summaction of the KF).
    Any ideas ??
    Greetz,
    Herman

    Hi Herman
        Please check the KF infoobject property which might have been set to Summation.  You need to change the property of the KF to MAX if you wish to have MAX value. 
        Hope this might be helpful to you
    Thanks
    Kishore Kusupati

  • Can I use Count, Max function in PLSQL BLOCK.

    Can U help me to use count, max function in PLSQL BLOCK.
    Because it is giving me error "It is a SQL function"

    SELECT COUNT(*)
    INTO l_variable
    FROM dual;
    Will work inside PL/SQL

  • How to use min-max functions for date in transformation in bpel?

    Hi,
    I have a requirement where i need to map earliest date of a Source field among all the dates to a target field in a transformation file in BPEL. There are functions called max-value-among-nodeset and min-value-among-nodeset in mathematical functions but they can be used only for numbers and strings.How to do these with dates?
    Thanks,
    Prasanna

    I exactly have the same requirement.Are you able to solve this?
    Its very urgent.Please help me.

  • Using the max function in a inner joined statement

    I am trying to take from a database with two joined tables various datas from the record belonging to paul that has the highest entry number.
    String query = "SELECT Table1.name, Table1.idNumber, Table2.Address Table2.entryNum FROM Table1 INNER JOIN Table2 ON Table1.idNumber = Table2.idNumber WHERE Table2.entryNum = max ( Table2.entryNum) AND Table1.name = 'Paul'";
    The error message i get is.
    Cannot have aggregate function in WHERE clause
    Thanks for any help

    I am trying to take from a database with two joined
    tables various datas from the record belonging to paul
    that has the highest entry number.SELECT
    Table1.name,
    Table1.idNumber,
    Table2.Address
    Table2.entryNum
    FROM Table1 INNER JOIN Table2 ON Table1.idNumber = Table2.idNumber
    WHERE Table2.entryNum =
    ( select max( Table2.entryNum) from table1, table2
    where table1.idNumber=table2.idNumber
    AND Table1.name = 'Paul'" );

  • Using Max Function in View Criteria

    Hi
    I am having a requirement where by i need to make use of max function in view criteria but not able to see any such option. Can someone please help me over it. Here is the requirement.
    In table i will be having multiple rows for an employee and i need to pick latest row based on a column say request_id For e.g.
    Emp RequestId
    A 1
    A 2
    A 3
    A 4
    So if i pass the employee id i should get Row Number 4. In simple SQL language I want something like this
    select * from emp where empid=A and requestid=( select max(requestid) from emp where empid=A)
    Just wanted to know is there any approach that i can use to do all this as part of View Criteria or any other way.
    Any help is appreciated!!!
    Thanks
    AJ

    One way is this -
    1)https://blogs.oracle.com/adf/entry/using_groovy_aggregate_functions_in (You might need to create a self-referencing VL for this , try if it works using a ViewAccessor too)
    OR
    Order by RequestId descending in your SQL for the VO if thats ok , then have the ViewCriteria for the EmpId and programmatically pickup the first row...

  • Bug? using MAX() function on char(1) column returns something larger

    details:
    -- we have a complex nested query, where we are essentially returning the max() value into a variable
    -- the max() function is being used on a char(1) column
    -- where MAX() is part of an inner select, we have started getting
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    errors.
    SELECT MAX(X) INTO var FROM ... works in 9i and 10g
    SELECT X INTO var FROM (SELECT MAX(X) X FROM ... worked in 9i, does not work in 10g!
    -- We never had problems with the code until upgrading to 10g release 2.
    -- the Solution is to cast the final value with TO_CHAR(). The cast MUST be done at the outer most point of the select:
    SELECT TO_CHAR(X) INTO var FROM (SELECT MAX(X) X FROM ... works
    SELECT X INTO var FROM (SELECT TO_CHAR(MAX(X)) X FROM ... causes an error!
    The following script demonstrates the issue, and includes the solution:
    * October 3, 2006
    * Possible SQL bug introduced with Oracle 10G
    * Natalie Gray DBA/Developer, Environment Canada
    * Description:
    * Have discovered a problem with using the MAX() function
    * on columns of type char(1)
    * only an issue when used in an inner select
    * solution (see test 4)
    CREATE TABLE SQL_BUG_TEST
    X NUMBER,
    Y NUMBER,
    Z CHAR(1)
    INSERT INTO SQL_BUG_TEST (X, Y, Z)
    VALUES (1,1,'A');
    INSERT INTO SQL_BUG_TEST (X, Y, Z)
    VALUES (1,1,'B');
    INSERT INTO SQL_BUG_TEST (X, Y, Z)
    VALUES (1,2,'C');
    INSERT INTO SQL_BUG_TEST (X, Y, Z)
    VALUES (1,2,'D');
    DECLARE
    TYPE REC IS RECORD (
          x SQL_BUG_TEST.X%TYPE,
          y SQL_BUG_TEST.Y%TYPE,
          z SQL_BUG_TEST.Z%TYPE
    v_rec REC;
    BEGIN
          -- DISPLAY THE TABLE DATA
          BEGIN
                 DBMS_OUTPUT.PUT_LINE('TABLE DATA:');
                DBMS_OUTPUT.PUT_LINE('');
                 DBMS_OUTPUT.PUT_LINE('SELECT * FROM SQL_BUG_TEST ORDER BY X,Y,Z;');
                 FOR crs IN (SELECT *
                                     FROM SQL_BUG_TEST
                               ORDER BY X,Y,Z) LOOP
                    DBMS_OUTPUT.PUT_LINE(':'||crs.X||':'||crs.Y||':'||crs.Z);
                END LOOP;
          EXCEPTION WHEN OTHERS THEN
                 DBMS_OUTPUT.PUT_LINE(SQLERRM);       
          END;
          -- TEST 1
          -- returning result from MAX into a variable when the MAX is in the outer most select
          -- does not cause an error
          BEGIN
                 DBMS_OUTPUT.PUT_LINE('*****************************************************');
                 DBMS_OUTPUT.PUT_LINE('TEST 1');
                DBMS_OUTPUT.PUT_LINE('');
                 DBMS_OUTPUT.PUT_LINE('SELECT X, Y, MAX(Z) Z');
                DBMS_OUTPUT.PUT_LINE('FROM SQL_BUG_TEST');
                DBMS_OUTPUT.PUT_LINE('GROUP BY X,Y');
                FOR crs IN (SELECT X, Y, MAX(Z) Z
                                     FROM SQL_BUG_TEST
                               GROUP BY X, Y
                               ORDER BY X,Y,Z) LOOP
                     DBMS_OUTPUT.PUT_LINE(':'||crs.X||':'||crs.Y||':'||crs.Z);
                END LOOP;
          EXCEPTION WHEN OTHERS THEN
               DBMS_OUTPUT.PUT_LINE(SQLERRM);
          END;
          -- TEST 2
          -- returning MAX() from an inner select to an outer select and then into a variable
          -- causes an error
          BEGIN
                 DBMS_OUTPUT.PUT_LINE('*****************************************************');
                 DBMS_OUTPUT.PUT_LINE('TEST 2');
                DBMS_OUTPUT.PUT_LINE('THIS DID NOT CAUSE AN ERROR WITH ORACLE 9i');
                DBMS_OUTPUT.PUT_LINE('');
                 DBMS_OUTPUT.PUT_LINE('SELECT * INTO v_rec');
                DBMS_OUTPUT.PUT_LINE('FROM');
                DBMS_OUTPUT.PUT_LINE('(SELECT X, Y, MAX(Z) Z');
                DBMS_OUTPUT.PUT_LINE('FROM SQL_BUG_TEST');
                DBMS_OUTPUT.PUT_LINE('GROUP BY X,Y)');
                DBMS_OUTPUT.PUT_LINE('WHERE Y = 1');
                SELECT * INTO v_rec
                FROM
                (SELECT X, Y, MAX(Z) Z
                 FROM SQL_BUG_TEST
                 GROUP BY X, Y)
                WHERE Y = 1;
                DBMS_OUTPUT.PUT_LINE(':'||v_rec.X||':'||v_rec.Y||':'||v_rec.Z);
          EXCEPTION WHEN OTHERS THEN
               DBMS_OUTPUT.PUT_LINE(SQLERRM);
          END;
          -- TEST 3
          -- casting the result from MAX to char before returning to the outer select
          -- still causes an error
          BEGIN
                 DBMS_OUTPUT.PUT_LINE('*****************************************************');
                 DBMS_OUTPUT.PUT_LINE('TEST 3');
                DBMS_OUTPUT.PUT_LINE('');
                 DBMS_OUTPUT.PUT_LINE('SELECT * INTO v_rec');
                DBMS_OUTPUT.PUT_LINE('FROM');
                DBMS_OUTPUT.PUT_LINE('(SELECT X, Y, to_char(MAX(Z)) Z');
                DBMS_OUTPUT.PUT_LINE('FROM SQL_BUG_TEST');
                DBMS_OUTPUT.PUT_LINE('GROUP BY X,Y)');
                DBMS_OUTPUT.PUT_LINE('WHERE Y = 1');
                SELECT * INTO v_rec
                FROM
                (SELECT X, Y, to_char(MAX(Z)) Z
                 FROM SQL_BUG_TEST
                 GROUP BY X, Y)
                WHERE Y = 1;
                DBMS_OUTPUT.PUT_LINE(':'||v_rec.X||':'||v_rec.Y||':'||v_rec.Z);
          EXCEPTION WHEN OTHERS THEN
               DBMS_OUTPUT.PUT_LINE(SQLERRM);
          END;
          -- TEST 4 - SOLUTION
          -- the return value of MAX must be cast with to_char at the point where it is assigned to
          -- variable (outer most select)
          BEGIN
                 DBMS_OUTPUT.PUT_LINE('*****************************************************');
                 DBMS_OUTPUT.PUT_LINE('TEST 4 SOLUTION');
                DBMS_OUTPUT.PUT_LINE('');
                 DBMS_OUTPUT.PUT_LINE('SELECT X, Y, TO_CHAR(Z) Z INTO v_rec');
                DBMS_OUTPUT.PUT_LINE('FROM');
                DBMS_OUTPUT.PUT_LINE('(SELECT X, Y, MAX(Z) Z');
                DBMS_OUTPUT.PUT_LINE('FROM SQL_BUG_TEST');
                DBMS_OUTPUT.PUT_LINE('GROUP BY X,Y)');
                DBMS_OUTPUT.PUT_LINE('WHERE Y = 1');
                SELECT X, Y, TO_CHAR(Z) Z INTO v_rec
                FROM
                (SELECT X, Y, MAX(Z) Z
                 FROM SQL_BUG_TEST
                 GROUP BY X, Y)
                WHERE Y = 1;
                DBMS_OUTPUT.PUT_LINE(':'||v_rec.X||':'||v_rec.Y||':'||v_rec.Z);
          EXCEPTION WHEN OTHERS THEN
               DBMS_OUTPUT.PUT_LINE(SQLERRM);
          END;
    END;

    I certainly looks like a bug, but you should raise an iTAR on Metalink since Oracle does not monitor this forum.
    I was able to replicate your results on my 10.2.0.1 database.
    There is an easier workaround than yours. Try
    ALTER TABLE sql_bug_test MODIFY (z VARCHAR2(1));That seems to eliminate the problem on my instance.
    John

  • Max() function in Data services

    Hi Experts,
         i'm using Data services (etl), and working on budget table(ms sql table),
    1. the table has a field [budget amount] and [version_no],
    2. before i extract the budget amount i need to know the highest version in [version_no] fields
    3. can any body help me on this? i tried to use the script:  ifthenelse(max(version-no),budget_amount, 0) but it retuns error when validation.
    please help me on this:
    thanks in advance
    Archie72

    Hi,
    Connect a Query transform say Query1 from the source table
    Inside Query1
    select MAX(version no) into the output. Do not select the other budget field into the output.
    Connect another Query transform say Query2 from the source table. Connect the output of Query1 also into Query2.
    Inside Query2:
    Join the source table and Query 1 in where
    Query1.version no = SourceTable.version no
    Select version no and budget into Query 2 output and connect it to target table.
    Assuming that the source table has only version number and budget. You might have to tweak and make use of Group By as required where you use the MAX() function. SourceTable mentioned in the where condition will be replaced with your exact source table name
    Regards,
    Suneer

  • Max function in select statemnt

    Hi,
       Can someone help me with what is wrong in the following query...How to use the max function
    in ABAP program select statement??
    Thanks..
    LOOP AT IT_ANLA_ANLZ INTO WRK_ANLA_ANLZ.
    SELECT KANSW
                FROM ANLC INTO TABLE IT_ANLC WHERE GJAHR IN ( SELECT MAX(GJAHR) FROM ANLC ) and ANLN1 = WRK_ANLA_ANLZ-ANLN1
                AND BUKRS = WRK_ANLA_ANLZ-BUKRS .
    APPEND IT_ANLC.
    ENDLOOP.

    Hi,
    You have write your select query once,
    and then loop on the internal table into
    which data will get populated for its display.
    SELECT KANSW
    FROM ANLC INTO TABLE IT_ANLC WHERE GJAHR IN
    ( SELECT MAX(GJAHR) FROM ANLC ) and ANLN1 = WRK_ANLA_ANLZ-ANLN1
    AND BUKRS = WRK_ANLA_ANLZ-BUKRS .
    Then loop at internal table:
    LOOP AT IT_ANLA_ANLZ INTO WRK_ANLA_ANLZ.
    write: / wrk_anla_anlz-fields.
    Endloop.
    Hope it helps
    Regards
    Mansi

  • Usage of MAX Function.

    Hi,
    One of our customers is facing an error while executing a PL/SQL block like,
    declare
    l_flag varchar2(30);
    begin
    select max('Y') into l_flag from v$database; -- Can use any table here
    end;
    however, when the select query is changed to as follows, no error is seen.
    select substr(max('Y'),1,30) into l_flag from v$database;
    Can someone please help me in identifying what could be issue?
    Thanks,
    Dola

    We are actually trying to check if the table contains any rows.Hmmm, I would have thought that using a MAX() function to do that is rather expensive (if it's a large table)...
    SQL> set autotrace traceonly stat
    SQL> select max('Y') from tt1
      2  /
    Statistics
              0  recursive calls
              0  db block gets
            432  consistent gets
            428  physical reads
              0  redo size
            378  bytes sent via SQL*Net to client
            499  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL>          
    SQL> select count(*) from tt1
      2  /
    Statistics
              0  recursive calls
              0  db block gets
            432  consistent gets
            423  physical reads
              0  redo size
            381  bytes sent via SQL*Net to client
            499  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL>          
    SQL> select null  from tt1
      2  where rownum = 1
      3  /
    Statistics
              0  recursive calls
              0  db block gets
              4  consistent gets
              5  physical reads
              0  redo size
            372  bytes sent via SQL*Net to client
            499  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> Cheers, APC

  • MAX Function not returning MAX

    I have a query that is pulling in EDI 214 status codes, and want to pull in the last received status for status type "AG". To do this, I'm using the MAX function on the INSERT_DATE field of the status code AG, but the query keeps returning both AG status codes. I've tried this in a single query (Query 1) but it did not work so I also attempted it in a much smaller query to be used as a subquery, but that still did not work. Can anyone identify what the issue is with what I'm attempting to do?
    Query 1 (All Inclusive):
    SELECT BS.SHIPMENT_GID AS BUY_SHIPMENT_GID,
    AGSS.EVENTDATE AS AG_EVENT,
    D1SS.EVENTDATE AS D1_EVENT,
    BS.START_TIME AS BUY_START_TIME,
    AGSS.STATUS_CODE_GID AS AG,
    D1SS.STATUS_CODE_GID AS D1,
    BS.DOMAIN_NAME AS BUY_DOMAIN,
    MAX(AGSS.INSERT_DATE) AS AG_INSERT_DATE,
    MAX(D1SS.INSERT_DATE) AS D1_INSERT_DATE,
    BS.START_TIME,
    BS.DOMAIN_NAME,
    SHIPSTAT.STATUS_VALUE_GID
    FROM V_ROD_SHIPMENT BS
    INNER JOIN V_ROD_SS_STATUS_HISTORY AGSH
    ON (BS.SHIPMENT_GID = AGSH.SHIPMENT_GID)
    INNER JOIN V_ROD_IE_SHIPMENTSTATUS AGSS
    ON (AGSH.I_TRANSACTION_NO = AGSS.I_TRANSACTION_NO)
    INNER JOIN V_ROD_SS_STATUS_HISTORY D1SH
    ON (BS.SHIPMENT_GID = D1SH.SHIPMENT_GID)
    INNER JOIN V_ROD_SHIPMENT_STATUS SHIPSTAT
    ON (BS.SHIPMENT_GID = SHIPSTAT.SHIPMENT_GID)
    INNER JOIN V_ROD_IE_SHIPMENTSTATUS D1SS
    ON D1SH.I_TRANSACTION_NO = D1SS.I_TRANSACTION_NO
    WHERE BS.START_TIME > '18/MAY/12'
    AND BS.DOMAIN_NAME = 'UPS/CP/HDMB'
    AND AGSS.STATUS_CODE_GID = 'AG'
    AND D1SS.STATUS_CODE_GID = 'D1'
    AND (SHIPSTAT.STATUS_VALUE_GID = BS.DOMAIN_NAME
    || '.SECURE RESOURCES_ACCEPTED'
    OR SHIPSTAT.STATUS_VALUE_GID = BS.DOMAIN_NAME
    || '.SECURE RESOURCES_PICKUP NOTIFICATION')
    GROUP BY BS.SHIPMENT_GID,
    AGSS.EVENTDATE,
    D1SS.EVENTDATE,
    BS.START_TIME,
    AGSS.STATUS_CODE_GID,
    D1SS.STATUS_CODE_GID,
    BS.DOMAIN_NAME,
    SHIPSTAT.STATUS_VALUE_GID
    Query 2 (to be used as a sub-query if I cannot pull MAX insert date in previous query):
    SELECT DISTINCT BS.SHIPMENT_GID AS BUY_SHIPMENT_GID,
    AGSS.EVENTDATE AS AG_EVENT,
    AGSS.STATUS_CODE_GID AS AG,
    MAX(AGSS.INSERT_DATE) AS AG_INSERT_DATE
    FROM V_ROD_SHIPMENT BS
    INNER JOIN V_ROD_SS_STATUS_HISTORY AGSH
    ON (BS.SHIPMENT_GID = AGSH.SHIPMENT_GID)
    INNER JOIN V_ROD_IE_SHIPMENTSTATUS AGSS
    ON (AGSH.I_TRANSACTION_NO = AGSS.I_TRANSACTION_NO)
    WHERE AGSS.STATUS_CODE_GID = 'AG'
    AND BS.SHIPMENT_GID = 'UPS/CP/HDMB.HDM-1000203768'
    GROUP BY BS.SHIPMENT_GID,
    AGSS.EVENTDATE,
    AGSS.STATUS_CODE_GID
    Results of query 2 (similar issue as query 1, query doesn't return MAX insert date):
    BUY_SHIPMENT_GID     AG_EVENT     AG     AG_INSERT_DATE
    UPS/CP/HDMB.HDM-1000203768     5/25/2012 6:00:00 PM     AG     5/21/2012 3:10:36 PM
    UPS/CP/HDMB.HDM-1000203768     6/1/2012 5:00:00 PM     AG     5/20/2012 2:36:18 PM
    I appreciate any help.
    Thanks,
    -Adam

    Hi, Adam,
    Welcome to the forum!
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    Simplify the problem as much as possible. Remove all tables and columns that play no role in this problem.
    If you can show what the problem is using commonly available tables (such as those in the scott schem) then you don't have to psot any sample data; just the results and the explanation.
    Always say which version of Oracle you're using.
    See the forum FAQ {message:id=9360002}
    MAX (insert_date) returns the latest insert_date. I think, in this problem, you don't really want the latest insert_date; you want the status code that's related to the last insert_date. One way to get that is the aggregate FIRST (or LAST) function.
    Consider this query, using the scott.emp table:
    SELECT       ename
    ,       hiredate
    FROM       scott.emp
    ORDER BY  hiredate
    ,            ename
    ;Output:
    ENAME      HIREDATE
    SMITH      17-Dec-1980
    ALLEN      20-Feb-1981
    WARD       22-Feb-1981
    JONES      02-Apr-1981
    BLAKE      01-May-1981
    CLARK      09-Jun-1981
    TURNER     08-Sep-1981
    MARTIN     28-Sep-1981
    KING       17-Nov-1981
    FORD       03-Dec-1981
    JAMES      03-Dec-1981
    MILLER     23-Jan-1982
    SCOTT      19-Apr-1987
    ADAMS      23-May-1987Say we're only interested in seeing the last hiredate, and the name of the person hired on that date:
    LAST_ENAME LAST_HIREDA
    ADAMS      23-May-1987Here's how to get those results using the aggregate LAST function:
    SELECT       MIN (ename) KEEP (DENSE_RANK LAST ORDER BY hiredate) AS last_ename
    ,       MAX (hiredate)                                              AS last_hiredate
    FROM       scott.emp
    ;What if there's a tie for the latest hiredate? For example, say we're only looking at people hired before 1982. In that case, the latest hiredate is December 3, 1981, and there happen to be two people hired on that date. This query
    SELECT       MIN (ename) KEEP (DENSE_RANK LAST ORDER BY hiredate) AS last_ename
    ,       MAX (hiredate)                                              AS last_hiredate
    FROM       scott.emp
    WHERE         hiredate     < DATE '1982-01-01'
    ;produces only 1 row of output:
    LAST_ENAME LAST_HIREDA
    FORD       03-Dec-1981Why did it show FORD rather than JAMES? Because of the MIN function. When there happens to be a tie for the latest hiredate, MIN says to return the first ename (in normal sort order) of the rows that have that hiredate.
    FIRST and LAST work with GROUP BY, too.
    In the example above, we were only looking at one column related to the latest hiredate. If we neede to see several columns, it would be simpler to use the analytic ROW_NUMBER function:
    WITH     got_r_num     AS
         SELECT  emp.*
         ,     ROW_NUMBER () OVER ( ORDER BY  hiredate  DESC
                                   ,            ename
                           ) AS r_num
         FROM    scott.emp
         WHERE     hiredate     < DATE '1982-01-01'
    SELECT     *
    FROM     got_r_num
    WHERE     r_num     = 1
    I hope this answers your question.
    If not, post a more complete explanation of what you want to do. if you have to use your own tables, then post CREATE TABLE and INSERT statements for a little sample data. Post the results you want from that data, and explain how you get those results from that data.

  • Using max function in PL/SQL

    VERY URGENT...
    Am new to oracle...
    I've written a package that display gif images in form of histogram/bar chart. using html,
    I need to use max function to display values proportionately.
    please help. i need to complete this assignment by 2/9/00 by 10.00 am at the latest. I've half written a function but I don't know if there's a simpler way fo doing this. html enabled

    First of all Thanks to all gentlemen who replied ..many thanks ...
    Tried the ROW_NUMBER() option but still it is taking time...have given output for the query and tkprof results as well. Even when it doesn't fetch any record ( this is a valid cased because the input header id doesn't have any workflow request submitted & hence no entry in the wf_items table)..then also see the time it has taken.
    Looked at the RANK & DENSE_RANK options which were suggested..but it is still taking time..
    Any further suggestions or ideas as to how this could be resolved..
    SELECT 'Y', 'Y', ITEM_KEY
    FROM
    ( SELECT ITEM_KEY, ROW_NUMBER() OVER(ORDER BY BEGIN_DATE DESC) RN FROM
    WF_ITEMS WHERE ITEM_TYPE = 'xxxxzzzz' AND ROOT_ACTIVITY = 'START_REQUESTS'
    AND SUBSTR(ITEM_KEY,1,INSTR(ITEM_KEY,'-') - 1) = :B1
    ) T WHERE RN <= 1
    call count cpu elapsed disk query current rows
    Parse 0 0.00 0.00 0 0 0 0
    Execute 1 0.00 1.57 0 0 0 0
    Fetch 1 8700.00 544968.73 8180 8185 0 0
    total 2 8700.00 544970.30 8180 8185 0 0
    many thanks

  • How to use MAX function in SSAS MDX Query

    I want to run this Query with MAX Condition on LAST_DATA_UPDATE Column .

    Hi Ashishsingh,
    According to your description, you want to know how to use MAX function in SQL Server Analysis Services MDX Query, right? In this case, please refer to the link below which describe the syntax and sample of MDX function.
    http://technet.microsoft.com/en-us/library/ms145601.aspx
    http://www.mdxpert.com/Functions/MDXFunction.aspx?f=64
    Hope this helps.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Oracle:how to use max() function in case expression

    how to use max() function in case expression, Please explain with any example

    Hope this helps and should be self explanatory
    with t as
    (select 1 col,100 col2 from dual union
    select 2 ,100 from dual union
    select 2 ,200 from dual union
    select 3,100  from dual union
    select 3,200  from dual  )
    select col, case when max(col2)=100 then 'with 100 range'
    when  max(col2)=200 then 'with 200 range' end  from t group by col

  • Max value without using max() function

    Hi
    Is there any way to get the max value from a table without using MAX() function
    Thanks

    well if you think about it i'm sure you'll find a solution
    what does max(field) means, it simply is the value of the field where no other value of the same field that is > than this value exists.
    consider the following :
    table TAB(
    fld NUMBER(5));
    translate the logic and you'll have
    select a.fld from TAB a where NOT EXISTS(select b.fld from TAB b where b.fld>a.fld) and rownum=1;
    of course there are better ways i'm sure, you'll just have to figure'em out.

Maybe you are looking for

  • InCopy workflow for newspaper

    We are a small weekly newspaper using Indesign CS3. We want to adopt a workflow using InCopy CS3 that will benefit all users. One goal is to be able to archive newsroom stories to our website that include the main story, headlines and all text associ

  • AIR-CAP1532I in a non-mesh environment

    Hi. I'm trying to get a CAP1532I working as a "normal access point" and not in a mesh environment. Is that possible? If I try to get the AP joining our controller ( 5508 with 7.6.120.0 ), I get these errors: *Mar  1 00:02:27.495: %CAPWAP-3-ERRORLOG:

  • Label Data view in the material master

    Hi all, I read this SAP help portal that said "The Label Data view in the material master allows you to display or  edit label data that is specific to the material. ".. may I know where I can find this view in the material master? Thanks Karen

  • Thicker lines in table

    Hi, Is it possible to have differences in thickness of the lines in a table? I would need a line between all my data and also lines for the header but those should be thicker so there is a clear difference. Can't find any information about this Thank

  • Where is the antenna located in the Style 9670?

    Hello I do not own a BB yet but thinking of buying a Style 9670 soon. It is still available in India and the phones here are not tied up to the service provider. My phone usage is minimal since it causes ear pain whenever I talk on a GSM/CDMA phone.