Rank Number In a Fomula

Hai Friends ,
   I have Appplied Calculate Single Value as Rank number in Sales Qty  Kf .So in the Report it is successFully showing the Rank Number Based On the Sales qty . I wanted To make the Top 15
Rank numbers As Rank (1 or A) and next 15 as Rank (2 0r B) and the others as Rank (3 or C)
So i have taken the Rank Formula In Another Formula But here Instead Of taking the Rank Number
It is taking the Sales Qty any light on this
<removed by moderator>
Regards
   Prasad
Edited by: Siegfried Szameitat on Jun 18, 2009 3:28 PM

Check the message in the link, similar to ur problem...
Re: How to display RANKED list

Similar Messages

  • Calculate single value as ranked number function does not apply in CR

    Hi everybody,
    I built up a query with the SAP BEx Query designer. For one key figure I enabled the function "Calculate single values" as ranked list. So the query has the following result.
    Instead of...
    Score
    1220
    2032
    2390
    2389
    ...I got...
    Score
    1
    2
    4
    3
    Unfortunately when importing the query to Crystal Reports Crystal is just importing the key figure itself - the ranked list does not exist... so the output is the same as in the first example.
    I tried to rebuild the formula with crystal means using the Rank function but I failed...
    Can anybody provide a workaround for me?
    Is there another way as using the formula workbench?
    Best regards,
    Sebastian

    Hi Ingo and everybody,
    I used now the following function using the Nth largest function:
    If nthlargest(1, {TECHNAME_OF_QUERY.[Measures]-[9XU9YT56S6PRL7DR80I3DK9RA]})
       = {TECHNAME_OF_QUERY.[Measures]-[9XU9YT56S6PRL7DR80I3DK9RA]} then "1"
    else if nthlargest(2, {TECHNAME_OF_QUERY.[Measures]-[9XU9YT56S6PRL7DR80I3DK9RA]})
       = {TECHNAME_OF_QUERY.[Measures]-[9XU9YT56S6PRL7DR80I3DK9RA]} then "2"
    else if nthlargest(3, {TECHNAME_OF_QUERY.[Measures]-[9XU9YT56S6PRL7DR80I3DK9RA]})
       = {TECHNAME_OF_QUERY.[Measures]-[9XU9YT56S6PRL7DR80I3DK9RA]} then "3"
    else if nthlargest(4, {TECHNAME_OF_QUERY.[Measures]-[9XU9YT56S6PRL7DR80I3DK9RA]})
       = {TECHNAME_OF_QUERY.[Measures]-[9XU9YT56S6PRL7DR80I3DK9RA]} then "4"
    else if nthlargest(20, {TECHNAME_OF_QUERY.[Measures]-[9XU9YT56S6PRL7DR80I3DK9RA]})
       = {TECHNAME_OF_QUERY.[Measures]-[9XU9YT56S6PRL7DR80I3DK9RA]} then "20"
    The formula is not very handsome and will fail, if the number of records exceeds...
    Are there any alternatives?
    And: Is there a possibility to change the field name, because those clumsy field names cause that the whole formula is almost unreadable. Or is the only way to build subreports?
    Regards,
    Sebastian

  • Possible to use ranking value in formula?

    Hi!
    User wants to compare previous month to current month ranking number to trend the change. Setup is 2 key fig with sales current month and sales previous month where row is sales office. Then calculate single value as rank. Now, I want to use the ranking value in a formula to compare this months rank vs previous months ranking, but it seems not to work as the formula takes the sales value and not the displayed ranking value. Is there a way to do this in bex or is the only way transformation..?
    Regards
    Henning

    You could create a key figure that always displays a fixed value example 1.
    You then restrict this individual key figure to payment method C.
    The key figure is now only 1 for payment method C.
    In your calculation you now say: if key figure = 1 then ... else ...
    If statements are not directly possible, you can only do if statemements indirectly by a similar formula:
    (key figure = 1) * value
    if key figure is one -> result of (key figure = 1) is 1
    1 multiplied by value = value
    if key figure is not one -> result of (key figure = 1) is 0
    0 multiplied by value = 0
    You now have an indirect if clause.
    Please assign points if this solved your problem,
    Best Regards,
    Filip

  • Finding the lowest number from several columns

    Hi all,
    I'm analysing data from students' two years course where they had 4 units. What I'd like to be able to do is see at a glance which of the 4 units for each student was their lowest - therefore allowing me to see if one unit in particular was letting them down. see pic and the 4 highlighted columns.
    I have got the info as a graph, but you have to look individual at each one.
    Can anyone help with a formula that could present the results for each student by the column header. E.g. In column A is the student names and in column B is the name of the column they got the lowest mark (in this case MS1, MS2, MS3 or MS4). I would love to be able make this as will really help next year's cohort!
    Best,
    Greg

    Hi Greg,
    Have a look at the SMALL function. It allows you to see the smallest, second smallest... value in a list.
    The SMALL function returns the nth-smallest value within a set of numeric values. The smallest value is ranked number 1.
    SMALL(value-set, ranking)
    value-set: A collection of number values, date/time values, or duration values. All values must be of the samevalue type.
    ranking: A number value representing the size ranking of the value you want to retrieve. ranking must be in the range of 1 to the number of values in the collection.
    Type = in a cell to bring up the Functions Panel. Type small in the search box.
    Regards,
    Ian.

  • How to get rank within the row in SQL

    I have an a key orderid and 4 other columns with orderdate&time in (16/12/2011 16:15:24 format) within a table.
    the orderid has an average of 1million rows every week hence could not do this in excel for a 15 day period .
    ORderid.........: mail........................................ : telephone ............................:online ........................................ store.......................... Agency
    A3456...........15/12/2011 16:15:24 ............... 16/12/2011 14:12:01.............16/12/2011 16:14:00..........17/12/2011 11:22:55 ............12/12/2011 22:20:30
    B678
    C555
    i want to create a new table which ranks each row according to the max orderdate and time say in another table
    i want to capture the rank
    KEY.......Mail............Tel............online.........store..........Agency
    A3456.....4 ...............3...............2...............1............... 5
    Is there any way either within the same table or in other table i wiould be able to get the rank based on the rows in SQL.
    thnks
    Edited by: UOOLK on 29-Dec-2011 06:46

    Something like this I think:
    create new_order_table as
      select order_id
            ,rank() over (order by mail desc) mail
            ,rank() over (order by telephone desc) telephone
            ,rank() over (order by online desc) online
            ,rank() over (order by store desc) store
            ,rank() over (order by agency desc) agency
        from old_order_table;Assuming you want the most recent date to be ranked number 1. If you want number 1 to be the oldest then remove all the 'desc's from the order by clauses.

  • Top N Report by ranking

    Hi,
    I would like to get Top 3 report for both Graph and tables in WAD. Sample output as :
    Transaction :
    Product Group | Customer    | Value
    ABC               |  123            |   3
    ABC               |  456            |   7
    ABC               |  789            |   6
    ABC               |  333            |   9
    DEF               |  123            |   10
    DEF               |  789            |   5
    PPP               |  333            |   2
    Output :
    Product Group | Top          | Value
    ABC               |  1            |   9                 -      which is customer 333
    ABC               |  2            |   7                 -      which is cusotmer 456
    ABC               |  3            |   6                 -      which is cusotmer 789
    DEF               |  1            |   10
    DEF               |  2            |   5
    PPP               |  1            |   2
    Or it would be even better to have the below format :
    Product Group |   Top1  | Top 2 | Top 3
    ABC               |    9      |    7     |  6
    DEF               |   10      | 5
    PPP               |   1       |
    Thanks in advance for any tips and solution !!
    Best Regards,
    Jo

    Hi,
    I am not sure that you can write 'Top1' 'Top2' etc as characteristics.
    However, you can use key figure for ranking them .
    Copy your 'value' key figure and name it 'Top'. In properties of this key figure, choose rank list.
    This will give you the rank number , not sure but you may use it in the graph, you can try that way.
    I hope this helps.
    Derya
    Edited by: Derya Akcakaya on May 2, 2008 10:49 AM

  • Gaps in Ranking

    There appears to be a bug in calculating the ranking of users that leaves gaps in the sequence.
    As an example, see http://scn.sap.com/reputation.jspa?username=jamie.wiseman#viewID=leaders
    and scan down the list.  Why is there nobody listed at rank 128?
    I have seen cases where there has been a tie for the number of points and multiple people
    had the same rank with an appropriate number of gaps above the ranking. But that isn't
    the case here.
    -bret

    Hi Audrey,
    Thanks for looking at it.
    I see an entry has been added to the SCN Gamification Known Issues document.
    The "Result: The set of five members shown above and below you might not be exact"
    wording in the entry seems a bit off, though.  The issue affects the ranking of everyone
    under a gap, it doen't have any particular relationship to the 5 members above and below the user.  Furthermore, the effect is cumulative, if there are 20 such gaps above a user, their ranking number will be 20 higher than it should be.
    I suspect the issue happens when there is a more-than-two-way tie; it appears that when someone in such a tie gains a few points, moving them out of the tie but not overtaking the next-highest ranked person, their rank is only increased by one, moving the gap for the other members of the tie up the chain.
    Example: Consider this scenario where C, D, and E are tied for rank 498.
    Rank      Name      Points
    500           A           10,000
    501           B             9,998
    498           C             9,800 <-- 2 gaps above as this is 3-way tie
    498           D             9,800
    498           E             9,800
    497           F             9,700
    D  then earns 2 more points.  (choice of D is arbitrary, could also be C or E)
    I think what happens is D's rank increases by only one to 499 when
    the rank should have increased to 500 in order to leave the 1-place gap just above the 2-place tie.
    Rank      Name      Points
    500           A           10,000
    501           B             9,998
    499           D             9,802
    498           C             9,800 <-- should now be 1-place gap above 2-way tie
    498           E             9,800
    497           F             9,700
    Cheers,
    -bret

  • Rank SQL need help

    I have a simple Table with 2 columns, customer_id (distinct) and Spend
    some same fake data
    CUST_ID     SPEND        RANK
    1234          -125           0
    1254          -12             0
    1547          0               0
    5478          0               0
    8874          1               1
    6587          1               2
    65555        124            3
    54784        124            4
    45777        1148          5
    45774        2458          6I need to create a Rank column but only create the Rank for positive transaction, negative and 0 will get a RANK of 0, the rest need to have a rank where low spend gets low rank, and high spend gets high rank. Also if a customer has the same spend just rank them in the Order of the row position, ties can't have the same rank number, what is the best way to do this ?
    was thinking of ising row_number () over, but not sure how to make the RANK of 0 happen.
    I am on 11G, thank you!

    Hi,
    Kodiak_Seattle wrote:
    I have a simple Table with 2 columns, customer_id (distinct) and Spend
    some same fake data
    CUST_ID     SPEND        RANK
    1234          -125           0
    1254          -12             0
    1547          0               0
    5478          0               0
    8874          1               1
    6587          1               2
    65555        124            3
    54784        124            4
    45777        1148          5
    45774        2458          6I need to create a Rank column but only create the Rank for positive transaction, negative and 0 will get a RANK of 0, the rest need to have a rank where low spend gets low rank, and high spend gets high rank. Also if a customer has the same spend just rank them in the Order of the row position, ties can't have the same rank number, What is "row position"?
    The query below will assign unique numbers to ties, but there's no telling which of the tying rows will get the lower number. You can add more expressions to the analytic ORDER BY clause if you want to number the ties in a particular way.
    what is the best way to do this ?
    was thinking of ising row_number () over, Exactly! ROW_NUMBER will assign distinct numbers. RANK or DENSE_RANK would give duplicate results in case of a tie.
    but not sure how to make the RANK of 0 happen.
    I am on 11G, thank you!One way is to use CASE to assign 0 to the non-positive spends, and also to sort negatives at the end when computing the ROW_NUMBERSELECT       cust_id
    ,       spend
    ,       CASE
               WHEN  spend <= 0
               THEN  0
               ELSE  ROW_NUMBER () OVER ( ORDER BY CASE
                                       WHEN spend > 0
                                       THEN spend
                                                                   END
           END          AS rnk
    FROM       fake_data
    ORDER BY  spend
    ;Edited by: Frank Kulash on Jul 20, 2011 3:53 PM
    Here's a slightly more elegant way, that avoids a nested CASE expression:
    SELECT       cust_id
    ,       spend
    ,       CASE
               WHEN  spend <= 0
               THEN  0
               ELSE  ROW_NUMBER () OVER ( PARTITION BY  SIGN (spend)
                                                      ORDER BY      spend
                              ,                 cust_id     DESC     -- or whatever
                                                                   END
           END          AS rnk
    FROM       fake_data
    ORDER BY  spend
    ;I also added an example of numbering ties in a particular order.
    Edited by: Frank Kulash on Jul 20, 2011 4:05 PM

  • How to hide dynamic parameters values in the URL with Reports 6i

    Hi,
    I want to know a way of hiding the parameters values when asking for a report through the web.
    Now I'm using the Reports 3.0.5.8 with a Cartridge defined in the Oracle Web Application Server 3.0.1.0.1. When you ask for a report with the parameters DESTYPE = cache and DESFORMAT = pdf, it is fully generated and in the Address or Location box of the browser, you can see http://webserver/cache/report.pdf (where cache is the virtual directory defined in the OWAS in which the .pdfs are cached). So, users cant see the Url used to generate the report.
    Im trying to upgrade this configuration to Reports 6i with Cgi in a web server. I generate reports with no problems. The problem I have is I cant find how to hide the parameters values as before. I mean, when I ask for a report, once its generated I can see http://webserver/cgi-bin/rwcgi60.exe?server=ServerName&report=report.rdf&userid=user/pass@connection&destype=cache&desformat=pdf&P1=value1&P2=value2 in the Location box. It allows user to ask for another report changing the values of the parameters. I use these parameters to execute some query written in the Data Model. For example, imagine that the P1 represents the company id, the user (that is supposed to see only data of its company) can change this id, ask for a new report and see data of another company.
    Ive already tried to use the key mapping option, but its not useful to me because the parameters values are dynamic and its impossible to define different entries in the cgicmd.dat for each possible value. The option of loading the parameter form before running a report is not useful to me either, because there exists specific screens for this purpose.
    Is there any solution?
    Thank you.
    Marma Bonfiglio.

    Hi Rakesh,
      I am using BI  7.0
    The last option I have is 'Hide' for 'Calculate single values as' .
    I have the below options  for 'Calculate single values as'
    1. Normalise  according to Next group  level  Resul.
    2. Normalize according to  Overall Result
    3. Rank number
    4.Olympic Rank Number
    5.Maximum
    6. Minimum
    7.Counter for all detailed values
    8.Counter for all detailed values that are non zero
    9.Moving average
    10.Moving average  That is  Not zero ,null or Error
    11. Hide.
    So could you please tell me where i can find 'suppress result' option for the keyfigure .
    Many thanks

  • Need HELP to pass results from procedure

    Hey Gurus,
    I need your help. I got a package (test) and inside the package two procedures (step1, step2). Now I want to pass the results from the procedure step1 (stat_rec.lev, stat_rec.chi_sq, stat_rec.chi_sig) to the other procedure step2 and make a select with where-clause. How can I manage this?? Got someone a idea??
    Here my package:
    CREATE OR REPLACE PACKAGE test1
    AS
    PROCEDURE step1(table_in IN VARCHAR2, column1 IN VARCHAR2,column2 IN VARCHAR2);
    TYPE stat_tab_rec IS RECORD(lev NUMBER, chi_sq NUMBER, chi_sig NUMBER, rank NUMBER);
    stat_rec stat_tab_rec;
    PROCEDURE step2(table_in IN VARCHAR2, column1 IN VARCHAR2,column2 IN VARCHAR2);
    END test1;
    Thanks for your help!!
    CREATE OR REPLACE PACKAGE BODY test1
    AS
    PROCEDURE step1(table_in IN VARCHAR2, column1 IN VARCHAR2,column2 IN VARCHAR2,column3 IN VARCHAR2,column4 IN VARCHAR2,column5 IN VARCHAR2)
    IS
    TYPE cur_crosstab IS REF CURSOR;
    cur_cross cur_crosstab;
    BEGIN
    OPEN cur_cross FOR 'WITH '
    ||'att_grp AS '
    ||'(SELECT '||column1||' as x1 , lev AS lev, '||column2||', '
    ||' CASE'
    ||' WHEN '||column2||' <= lev '
    ||' THEN 1 '
    ||' ELSE 2 '
    ||'END attribute_group '
    ||'FROM '||table_in||', '
    ||'(SELECT level AS lev '
    ||'FROM dual '
    ||'WHERE level >= (SELECT MIN('||column2||') FROM '||table_in||') CONNECT BY level <= (SELECT MAX('||column2||') FROM '||table_in||'))) '
    ||'SELECT lev, '
    ||'ROUND(STATS_CROSSTAB(x1,attribute_group,''CHISQ_OBS''),4) AS chi_square, '
    ||'ROUND(STATS_CROSSTAB(x1,attribute_group,''CHISQ_SIG''),4) AS significance, '
    ||'dense_rank() over (order by ROUND(STATS_CROSSTAB(x1,attribute_group,''CHISQ_OBS'' ),4) DESC) AS rank '
    ||'FROM att_grp '
    ||'GROUP BY lev '
    ||'ORDER BY lev';
    LOOP
    FETCH cur_cross INTO stat_rec;
    EXIT WHEN cur_cross%NOTFOUND;
    IF stat_rec.rank = 1 THEN
    DBMS_OUTPUT.put_line(column2);
    DBMS_OUTPUT.put_line(stat_rec.lev|| ' = ' || TO_CHAR(stat_rec.chi_sq,'99.99') || TO_CHAR(stat_rec.chi_sig,'99.99'));
    END IF;
    END LOOP;
    CLOSE cur_cross;
    END step1;
    PROCEDURE step2
    IS
    BEGIN
    END step2;
    END test1;

    Thank you Massimo. I tried your example but I recieve an error: PLS-00306: wrong number or types of arguments in call to "procedure1"
    Here my Codes:
    CREATE OR REPLACE TYPE stat_obj IS OBJECT(zeilen NUMBER,lev NUMBER, chi_sq NUMBER, chi_sig NUMBER);
    CREATE OR REPLACE TYPE stat_tab IS TABLE OF stat_obj;
    CREATE OR REPLACE PROCEDURE procedure1(table_in IN VARCHAR2,column1 IN VARCHAR2,column2 IN VARCHAR2, v OUT stat_tab)
    IS
    TYPE cur_crosstab IS REF CURSOR;
    cur_cross cur_crosstab;
    TYPE stat_tab_rec IS RECORD(lev NUMBER, chi_sq NUMBER, chi_sig NUMBER);
    stat_rec stat_tab_rec;
    BEGIN
    OPEN cur_cross FOR 'WITH '
    ||'att_grp AS '
    ||'(SELECT '||column1||' as x1 , lev AS lev, '||column2||', '
    ||' CASE'
    ||' WHEN '||column2||' <= lev '
    ||' THEN 1 '
    ||' ELSE 2 '
    ||'END attribute_group '
    ||'FROM '||table_in||', '
    ||'(SELECT level AS lev '
    ||'FROM dual '
    ||'WHERE level >= (SELECT MIN('||column2||') FROM '||table_in||') CONNECT BY level <= (SELECT MAX('||column2||') FROM '||table_in||'))) '
    ||'SELECT lev, '
    ||'ROUND(STATS_CROSSTAB(x1,attribute_group,''CHISQ_OBS''),4) AS chi_square, '
    ||'ROUND(STATS_CROSSTAB(x1,attribute_group,''CHISQ_SIG''),4) AS significance, '
    ||'dense_rank() over (order by ROUND(STATS_CROSSTAB(x1,attribute_group,''CHISQ_OBS'' ),4) DESC) AS ranking '
    ||'FROM att_grp '
    ||'GROUP BY lev '
    ||'ORDER BY lev';
    LOOP
    FETCH cur_cross INTO v;
    EXIT WHEN cur_cross%NOTFOUND;
    --IF v_stat_tab.rank = 1 THEN
    --DBMS_OUTPUT.put_line(v_stat_tab.lev || '=' || TO_CHAR(v_stat_tab.chi_sq,'99.99') || TO_CHAR (v_stat_tab.chi_sig,'99.99'));
    --END IF;
    END LOOP;
    CLOSE cur_cross;
    END;
    CREATE OR REPLACE PROCEDURE procedure2
    IS
    v_zeilen NUMBER;
    v_lev NUMBER;
    v_chi_sq NUMBER;
    v_chi_sig NUMBER;
    v stat_tab;
    BEGIN
    procedure1(v);
    SELECT zeilen,lev,chi_sq,chi_sig INTO v_zeilen,v_lev,v_chi_sq,v_chi_sig
    from table(v);
    DBMS_OUTPUT.put_line(v_zeilen||v_lev||v_chi_sq||v_chi_sig);
    END;
    Hope u can help me!!

  • Reverse y axis columns

    Hi.
    I'm using numbers to create a chart for my website alexa rank. x axis is dates; like september 13 2011. and y axis is site rank in each day. as you know, when rank number is lower its better, so I need to reverse the y axis columns. how can I do this?

    Numbers always graphs with values ascending toward the top of the chart, so you'll need to do a minor fiddle on the data to make the graph do otherwise.
    Here's an example showing alexa's rank in an imagined list of 10 sites.
    Columns C and D contain the same formula, but with one argument changed.
    C: =RANK(B2,B,0)
    D: =RANK(B2,B,1)
    Each is filled down its respective column.
    The third argument controls the direction of the ranking. The second (in column D) is selected as the set of values to be charted.
    In the Chart Inspector, click on Axis, then uncheck "Show Value Labels" in the Value Axis (Y) pop-up menu.
    Replace the now missing values with a descending list as shown, typed into a text box. You'll need to use the Text inspector to adjust the space between lines to align the numbers with the grid lines on the chart.
    Regards,
    Barry

  • How to improve performance of this SQL query?

    Hi,
    I have a query that tries to build a string (RPATH) for use as a url parameter. The query is:
    SELECT DISTINCT USERNAME, PASSWORD, ROLE, RIGHTS,
    DECODE(GEO, ROLE, 'g='||NVL(GEO,'none'), NULL)||
         DECODE(AREA, ROLE, 'g='||NVL(GEO,'none')||'&a='||NVL(AREA,'none'), NULL)||
         DECODE(REGION, ROLE, 'g='||NVL(GEO,'none')||'&a='||NVL(AREA,'none')||'&r='||NVL(REGION,'none'), NULL)||
         DECODE(DISTRICT, ROLE, 'g='||NVL(GEO,'none')||'&a='||NVL(AREA,'none')||'&r='||NVL(REGION,'none')||'&d='||NVL(DISTRICT,'none'), NULL)||
         DECODE(OFFICE, ROLE, 'g='||NVL(GEO,'none')||'&a='||NVL(AREA,'none')||'&r='||NVL(REGION,'none')||'&d='||NVL(DISTRICT,'none')||'&o='||NVL(OFFICE,'none')
    , NULL) RPATH
    FROM (SELECT U.*, L.*
         FROM (SELECT * FROM T_USERS WHERE USERNAME='xxx' AND PASSWORD='yyy') U, T_LOC_SUB L
         WHERE U.ROLE IN ('WW', L.GEO, L.AREA, L.REGION, L.DISTRICT, L.OFFICE))
    GROUP BY USERNAME, PASSWORD, ROLE, RIGHTS, GEO, AREA, REGION, DISTRICT, OFFICE;
    T_USERS is defined as
    CREATE TABLE T_USERS (
    username          VARCHAR2(10)     CONSTRAINT T_USERS_username_pk PRIMARY KEY,
    password          VARCHAR2(10),
    role                    CONSTRAINT T_USERS_role_FK REFERENCES T_LOC_MAIN(loc),
    rights          VARCHAR2(3)
    T_LOC_SUB is defined as
    CREATE TABLE T_LOC_SUB (
    geo          CONSTRAINT T_LOC_SUB_geo_FK REFERENCES T_LOC_MAIN(loc),
    area          CONSTRAINT T_LOC_SUB_area_FK REFERENCES T_LOC_MAIN(loc),
    region          CONSTRAINT T_LOC_SUB_region_FK REFERENCES T_LOC_MAIN(loc),
    district     CONSTRAINT T_LOC_SUB_district_FK REFERENCES T_LOC_MAIN(loc),
    office          CONSTRAINT T_LOC_SUB_office_FK REFERENCES T_LOC_MAIN(loc)
    T_LOC_MAIN is defined as
    CREATE TABLE T_LOC_MAIN (
    loc          VARCHAR2(4)     CONSTRAINT T_LOC_MAIN_loc_PK PRIMARY KEY,
    label          VARCHAR2(60),
    rank          NUMBER
    REGION and DISTRICT columns in T_LOC_SUB may be NULL at times. How can I rewrite the SQL to make it run faster or more efficiently?
    Please help.. Thank you..

    Hi,
    I just realised I can simplify the query to:
    SELECT DISTINCT USERNAME, PASSWORD, ROLE, RIGHTS,
    DECODE(ROLE,
         GEO, 'g='||NVL(GEO,'none'),
         AREA, 'g='||NVL(GEO,'none')||'&a='||NVL(AREA,'none'),
         REGION, 'g='||NVL(GEO,'none')||'&a='||NVL(AREA,'none')||'&r='||NVL(REGION,'none'),
         DISTRICT, 'g='||NVL(GEO,'none')||'&a='||NVL(AREA,'none')||'&r='||NVL(REGION,'none')||'&d='||NVL(DISTRICT,'none'),
         OFFICE, 'g='||NVL(GEO,'none')||'&a='||NVL(AREA,'none')||'&r='||NVL(REGION,'none')||'&d='||NVL(DISTRICT,'none')||'&o='||NVL(OFFICE,'none'),
         NULL) RPATH
    FROM (SELECT U.*, L.*
    FROM (SELECT * FROM T_USERS WHERE USERNAME='xxx' AND PASSWORD='yyy') U, T_LOC_SUB L
    WHERE U.ROLE IN ('WW', L.GEO, L.AREA, L.REGION, L.DISTRICT, L.OFFICE))
    GROUP BY USERNAME, PASSWORD, ROLE, RIGHTS, GEO, AREA, REGION, DISTRICT, OFFICE;
    Anyone can offer a better and more efficient improvement?
    Thanx!

  • Problem accessing float in stored procedures

    I wrote a stored procedure that updates a column in a table whose datatype is of float(126). I declared a global variable in the stored procedure. The value of this variable is computed in the stored procedure and is used to update the table. My problem is an error message denoting my variable declaration to be at fault keeps on showing up even if I tried different datatypes in my declaration. I've tried RANK NUMBER, RANK NUMBER(19),
    RANK FLOAT(126) even RANK NUMBER(2,2). Can anyone help?

    Albert,
    I don't know what you mean by a "global" variable in a stored procedure. Is this a java stored procedure, or is it a PL/SQL stored procedure? If it is PL/SQL, perhaps the PL/SQL forum would be more appropriate?
    For your information, the following (PL/SQL) stored procedure works fine for me on a Oracle 9.2.0.4 database:
    create or replace procedure avi as
    fv float(126);
    begin
    fv := 1.7;
    dbms_output.put_line(to_char(fv));
    end;Perhaps you would care to provide some more information?
    [But I'm not guaranteeing that I will be able to resolve your issue, if you do.]
    What database version are you using?
    Is this a java stored procedure?
    Please post the entire error message (and stack trace?) you are getting.
    Please post the code that is causing the error. [Enough code so that I can try and reproduce your situation on my computer.]
    Good Luck,
    Avi.

  • Can I use decode( decode...)...)

    Hi,
    Can I use decode function inside decode function.
    It seem doesn't work. Please help
    decode(lv.RANK||' / '||
    decode('('||lv.ONE_YR_PCT||'%)', '(%)','N/A','('||lv.ONE_YR_PCT||'%)'),
    '0 / (0%)','N/A', lv.RANK )
    Thanks

    I'm not quite sure it's the result you intended but your nested decode statement does run ...
    SQL> CREATE TABLE lv (rank number, one_yr_pct number)
      2  /
    Table created.
    SQL> insert into lv values (1, 1)
      2  /
    1 row created.
    SQL> insert into lv values (2,2)
      2  /
    1 row created.
    SQL> insert into lv values (0,0)
      2  /
    1 row created.
    SQL> select decode(lv.RANK||' / '||
      2  decode('('||lv.ONE_YR_PCT||'%)', '(%)','N/A','('||lv.ONE_YR_PCT||'%)'),
      3  '0 / (0%)','N/A', lv.RANK )
      4  from lv
      5  /
    DECODE(LV.RANK||'/'||DECODE('('||LV.ONE_
    1
    2
    N/A
    SQL> If you're having problems maybe you should cut'n'paste the output from your SQL*Plus session so we can see what's happening.
    Alternatively, as CD suggests, you may find it easier to express your logic using CASE.
    Cheers, APC

  • Sort by "total" in Answers

    Based on a star schema model in OBIEE, i create the following report in Answers:
    Year > Customer Sector > Customer Ranking > Number of Customers > Profitability
    I want to display the report so that, for a given year, sectors are displayed in order of overall profitability. After adding sub-totals on the "Customer Sector" level in the Answers report, and then sorting by profitability just sorts the profitability per customer ranking in ascending/descending order, but it doesnt sort on the total sum of profitability per sector.
    Would anyone be able to provide some insight on how to go about this?
    best regards
    - Magnus

    that sort is for individual values for that measure, but not for sub-totals.
    if you want to sort on sub-totals, follow this:
    i'm assuming that for that profitability column sub-total is sum of individual values for that segment..
    create other column in criteria tab:
    change it's fx to: sum(Profitability by Year, Sector)
    then, keep first sort order asc/desc on this column
    hide this column
    apply 2nd sort order asc/desc on normal profitability column..
    hope it resolve your issue....

Maybe you are looking for

  • Premier Pro CS4 and Camtasia imported screen capture

    I have a question from one of you professionals regarding Camtasia screen capture video imported to PP. I used several settings that was suggested in the posts in these forums and others and the quality of my video is still very bad. Please Help: I a

  • Print JSP/HTML Pages (perhaps PDF?)

    Hi, i have a table in HTML generated by JSP. Just like the following simple example: ...<table> <% for( Enumeration et = free.getSqlIDs().elements(); et.hasMoreElements();) String keyt = (String)et.nextElement(); Bean b = new Bean(); b.init(path,DB);

  • Exporting podcast how to change "Artist"

    I'm exporting a podcast using GB3. I've changed the user name to "Anne" but the artist keeps coming up as "Chris" (the former user of the computer), I've also changed the 'composer name' in the preference to "Anne". But after exporting and loading in

  • No Music In Seychelles iTunes Store

    Hi All, I just changed my store account from UK to Seychelles, and to my utter disapointment, there is no music on the latter store. Looking for people with the same problem. Cheers.

  • I was installing the latest version of Flash player for IE.

    I received an error message that said Script Error saying that an object was expected.  I have the latest version for Google Chrome but I can't get Internet Explorer updated to the latest version.  Help!