Distinct function in Discoverer

Is there a way to use a distinct function in discoverer on a text field? I have the below calculation which concatenates 4 fields.
Point Of Sales His.Submitting Partner Number||' - '||Point Of Sales His.Cleansed Submit Partner Number||' - '||Point Of Sales His.Submitting Partner Name||' - '||Point Of Sales His.Cleansed Submit Partner Name
without a distinct function the report pulls in well over a million records and cant be used in excel. The 4 fields i am pulling in contain information that is repeated hundreds of times over within the table, but i only want to see 1 record for each unique return. Each record contains additional information which make the entire record unique, but I am not interested in that information at this time.
Any ideas?
Thanks
Chris

Hi Chris
If you have millions of rows of data then although Tamir's suggestion will work you might find that it takes a while to run.
If your data does not have to be up to the minute I would consider creating a new table and populating it nightly with the data that you need. You can then use a SELECT DISTINCT query in a procedure and even index the column in question. This will make report performance must, much faster.
Best wishes
Michael

Similar Messages

  • How to use Pl/Sql function in Discoverer report

    Hi Everybody,
    Would you be able to provide a workflow/guidance how to use sql function in Discoverer right from creating the function using PLSQL Developer.
    (I am new to Oracle environment... prev. worked as analyst with Microsoft Access... took PL/Sql class in school a few years ago)
    We are using Discoverer Desktop.
    a) Just emailed dba for permission to create pl/sql function.
    b) Recently got Discoverer Administrator installed on my pc.
    can you pls add to the list:
    c)....
    d)....
    etc.?
    tx for your help, sandra

    Hi Kranthi,
    Thx for your warm words....
    The links you provided are great! Thx soooo much!
    Thanks to you and the rest of forum members, am able to use what you've all taught me
    with other Discoverer reports.... so i was able to do more on my own....
    About a month ago, I got access to Discoverer Admin, and was able to paste SQL to create a custom folder.
    Then i joined the custom folder to an existing baseline folder.
    I have found that sometimes when I use calc within a calc when the calcs use analytic functions, that Discoverer
    just displays null in the column. I thought that maybe instead I could create my own function as a work-around.
    I wrote IT for permissions to create views, functions etc. Hopefully, they'll approve and can move toward learning
    pl/sql functions for Discoverer.
    tx again, sandra

  • Passing parameter into select statement by using function in discoverer

    I have created two functions in database named Period_in and Period_out and a global variable  g_period_name
    I have called Period_out function in VIEW(Select statement where condition).
    I have registered Period_in function in discoverer admin then created calculation (called Period_in(:input parameter))in discoverer plus.
    My expectation is user will enter period name and that will hit Period_in function and returns 1 and stores entered period name in g_period_name at runtime. then VIEW will executed and fetches data.
    But i am getting no data found.
    Problem is 2 functions running at the same time in select statement. Please help me to overcome this. Thanks in advance
    FUNCTION period_in (p_period VARCHAR2)
          RETURN NUMBER
       AS
       BEGIN
          g_period_name := p_period;
          RETURN 1;
       END period_in;
       FUNCTION period_out
          RETURN VARCHAR2
       AS
       BEGIN
          RETURN g_period_name;
       END period_out;

    You can use this code: 
    WITH cte
    AS ( SELECT EmpID ,
    EmpName ,
    [dbo].[udf_testFunction](EmpID) AS testfunctionvalue
    FROM #Temp
    SELECT EmpID ,
    EmpName ,
    testfunctionvalue ,
    testfunctionvalue * EmpID ,
    testfunctionvalue + 2
    FROM cte
    But using scalar functions in select clause can hurt the performance. Please see this link: 
    SQL Server Scalar User Defined Function Performance
    T-SQL Articles
    T-SQL e-book by TechNet Wiki Community
    T-SQL blog

  • DISTINCT Function Problem

    I am trying to use the DISTINCT function to work with a column that has a LONG datatype and I get an error that states: "ORA-00932: inconsistent datatypes: expected NUMBER got LONG". Here is the code I used to create the table and then run the DISTINCT function:
    CREATE TABLE PS_R_EMPL_DATA
    EMPLID VARCHAR2(11 BYTE) NOT
    NULL,
    EMPL_RCD INTEGER NOT
    NULL,
    R_401K_VESTING_DT DATE,
    R_UNPAID_LEAVE_DT DATE,
    R_PAID_LEAVE_DT DATE,
    R_EXPECTED_RETN_DT DATE,
    R_DISIB_VERIF_THRU DATE,
    R_CIGNA_NOTIFIED VARCHAR2(1 BYTE) NOT
    NULL,
    R_LEAVE_REASON VARCHAR2(1 BYTE) NOT
    NULL,
    R_BIRTH_DUE_DT DATE,
    R_PARTIAL_LEAVE_DT DATE,
    R_PARTIAL_WORK_HRS NUMBER(4,2) NOT
    NULL,
    R_CUBE VARCHAR2(10 BYTE) NOT
    NULL,
    R_FLOOR VARCHAR2(10 BYTE) NOT
    NULL,
    R_ACQUISITION_DT DATE,
    R_PENSION_START_DT DATE,
    R_PENSION_END_DT DATE,
    R_RMID VARCHAR2(13 BYTE) NOT
    NULL,
    MAIL_DROP VARCHAR2(50 BYTE) NOT
    NULL,
    R_NO_USERID VARCHAR2(1 BYTE) NOT
    NULL,
    R_KEEP_NTID VARCHAR2(1 BYTE) NOT
    NULL,
    R_CE_START_DT DATE,
    R_NOTICE_PERIOD VARCHAR2(2 BYTE) NOT
    NULL,
    R_EXACT_COST_CTR VARCHAR2(6 BYTE) NOT
    NULL,
    R_GEN_ID VARCHAR2(3 BYTE) NOT
    NULL,
    COMMENTS LONG
    -- Then I ran the DISTINCT function
    SELECT DISTINCT EMPLID, SUBSTR(COMMENTS, 1, 10) FROM
    ps_r_empl_data
    Any help would be greatly appreciated.
    Thanks

    Hi,
    You cannot use the Long datatype with distinct function... Oracle doesnt allow that. I am sure there is a work around though...

  • User Aggregated Function in Discoverer

    Hi.
    I'm trying to use an "User Aggregated Function" in Discoverer. This function concatenates a varchar field, and I want to use as a max(), min() or count() functions, but Discoverer always write this function in the group block of the query, and the databse generates an error.
    This is the user agrgegated function:
    CREATE OR REPLACE function DDS_UXXIINV.var_agg (input varchar2) return varchar2
    parallel_enable aggregate using agg_t;
    The package agg_t is defined as:
    create or replace type agg_t as object (
    str_agg varchar2(4000),
    static function ODCIAggregateInitialize(sctx in out agg_t)
    return number,
    member function ODCIAggregateIterate (self in out agg_t,
    value in varchar2 )
    return number,
    member function ODCIAggregateTerminate (self in agg_t ,
    return_value out varchar2,
    flags in number )
    return number,
    member function ODCIAggregateMerge(self in out agg_t,
    ctx2 in agg_t )
    return number
    create or replace type body agg_t is
    static function ODCIAggregateInitialize(sctx in out agg_t)
    return number is
    begin
    sctx := agg_t(null);
    return ODCIConst.Success;
    end;
    member function ODCIAggregateIterate(
    self in out agg_t, value in varchar2)
    return number is
    begin
    str_agg := str_agg || value;
    return ODCIConst.Success;
    end;
    member function ODCIAggregateTerminate(self in agg_t,
    return_value out varchar2, flags in number) return number is
    begin
    return_value := str_agg;
    return ODCIConst.Success;
    end;
    member function ODCIAggregateMerge(self in out agg_t,
    ctx2 in agg_t) return number is
    begin
    str_agg := str_agg || ctx2.str_agg;
    return ODCIConst.Success;
    end;
    end;
    When I use this functions (as a calculated field) Discoverer generates this statment:
    select var_agg(field1), field2 form table group by var_agg(field1), field2;
    I want this statement:
    select var_agg(field1), field2 form table group by field2;
    Sometimes Oracle generates a error messages saying that there's a wrong combinations of joins (translated from spainsh)
    Regards
    Óscar Blanco

    Hi,
    Unfortunately, you cannot import user defined group functions into Discoverer, Discoverer does not understand them.
    Rod West

  • Distinct function in Advance Sql

    Hi
    In OBIEE 10g, i need to write a distinct query for an attribute(City) in Advance SQL filter.
    Please send me the syntax to use Distinct function in Advanced SQL filter.

    Hi,
    In Advanced Filter write this
    "Table"."Column Name" IN (SELECT DISTINCT "Table"."Column Name" FROM "Subject Area")

  • Distinct function in view

    Hi i am having one query which is not getting executed in 10g database but in 9i it is getting executed.
    it is a select statement which uses distinct function on a view.
    Eg. select distinct(custid) from cust_view cview (where custid is the column present in the view cust_view and cview is the alias name)
    is it the problem with the database or the query.
    If i give select (custid) from cust_view cview it is working.is there any parameter to be set in database or distinct or any other function can't be used on the views.
    pls help

    Instead of waiting for the query to be execute. you can only fetch the execution plan of the query. like:
    SQL> set autot off
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    SQL> set autot traceonly
    SQL> select * from emp where empno = 7369;
    Execution Plan
    Plan hash value: 3956160932
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |     1 |    37 |     3   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| EMP  |     1 |    37 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("EMPNO"=7369)
    Statistics
              1  recursive calls
              0  db block gets
              4  consistent gets
              0  physical reads
              0  redo size
            822  bytes sent via SQL*Net to client
            381  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> set autot off
    SQL>

  • Use of DECODE function in Discoverer 3.1

    Hi all,
    Is there any better way of using DECODE in Discoverer 3.1, i dont want to use that function in my Discoverer User edition or Admin ed.
    Many of my queries use the DECODE function.
    Your help is greatly appreciated.

    If you created an instance of your time class that you called myTime
    var myTime:Time = new Time(15,15,0);
    and later you wanted another instance with the same time you could write
    var myTime2:Time = myTime.clone()
    It is just there for convienience and doesn't have anything much to do with MVC

  • Importing PL/SQL function in Discoverer Admin

    Gents
    I'm trying to import a PL/SQL function. In fact this functions is in a package.
    When I try to import in Discoverer Admin, I'm not able to see this package and the function.
    It's possible import a function from a package in Discoverer?
    Must a grant some privilege in package or create a synonym?
    Regards
    Honorio

    Hey,
    I have a similar problem.
    I created a PL/SQL Function which i registered in my EUL. Bun when I'm using this function on an item in a custom folder, this custom folder disappeared from my Discoverer Plus list of folders? When I delete the item which uses this function the folder shows up in my Discoverer Plus list of folders.

  • Date Functions in Discoverer Query

    Hi,
    It has been a while since I logged into the forum. Sorry at present my contribution is only to get help. Hope to help others in future.
    Here is teh problem I am facing.
    We have frequent requirement to get the sales comparison by last year to this year
    in Week to Date, Month to Date, Year to Date timeline.
    To accomplish I use Custom Date functions in my Discoverer which results in query like below
    SELECT o100229.curr_division_code,
    SUM (DECODE (discotw_admin.fiscal_cal_by_wk.flyrweek (:fyrweek),
    o100059.fiscal_year_week, o100341.tot_lines_ext_i_s_avg_cst,
    0
    The "discotw_admin.fiscal_cal_by_wk.flyrweek (:fyrweek)" is the function I use to get the Last year week number nased on the parameter for this week number.
    But the problem with this approach is it fires the Function every time a record is read by the query which makes the query to run long time.
    Is there anyway I can use a subquery that fires the function only once and use the value of the function in the main query in Discoverer.
    I did tried to create a custom folder for the Date functions and use it in the query so that the query references the field on the cusom folder. But still I do not see any improvement in the performance.
    Thanks in advance
    Jay

    Hi Jay
    Yes, calculating like this on every row will have a drag on performance.
    Have you considered using one of the analytic functions LAG or LEAD? They are designed for this type of reporting.
    If you have considered them and rejected them can you explain why.
    Another possibility is to use a SUM analytic like this:
    SUM(Selling Price SUM)
    OVER(PARTITION BY Size,Product
    ORDER BY TO_DATE("Year",'YYYY')
    RANGE BETWEEN INTERVAL '1' YEAR PRECEDING
    AND INTERVAL '1' YEAR PRECEDING )
    The caveat here is that RANGE INTERVAL must be a YEAR and the ORDER BY must return a date!
    Does this help?
    Best wishes
    Michael

  • How to call Plsql function in discoverer

    Hello,
    Can anyone tell me how to call plsql fuunction in Oracle Business Intelligence Desktop Discoverer?
    what i was doing here is i am able to register my function in Administration but i dont know when i need to make call and where i need to pass parameters to make call that function.
    its lil urgent, can any of you guys send me the instructions step by step
    Thanks in advance!!
    sid

    Thanks for your reply Michael,some how i found that make call from calculation , but the problem here is i was not able to pass parameter thru function.please find the scenario below,
    case(1) i have function without parameters, it does some DML operations inside that and it is working fine.when i refresh i see tables getting populated.
    case(2)I have another function as shown below with parameters(input) but i was getting error (One of The function arguments has an incorrect datatype:POST_SAVE_DOCUMENT)
    my function is like this:
    create or replace function POST_SAVE_DOCUMENT
    (P_WORKBOOKOWNER in VARCHAR2,
    P_WORKBOOK in VARCHAR2,
    P_WORKSHEET in VARCHAR2,
    P_SEQUENCE in number,
    P_SQL_SEGMENT in VARCHAR2
    return number AS
    BEGIN
    delete from my_sql;
    insert into my_sql
    ( WORKBOOKOWNER,
    WORKBOOK,
    WORKSHEET,
    SEG_SEQUENCE,
    SQL_SEGMENT)
    VALUES ( P_WORKBOOKOWNER,
    P_WORKBOOK,
    P_WORKSHEET,
    P_SEQUENCE,
    P_SQL_SEGMENT
    return 1;
    end;
    i dont see anything wrong here with in this function, but some how i have a problem with parameter.
    Can you give some idea or solution to get rid of this problem.
    Finally ..i did not see anything under item radio button (The recommended way now is to click the Items radio button, find an item that you want to pass to a parameter, then on the right-hand side highlight the placeholder for the parameter, then finally you click the Paste button. You repeat this for all the parameters and then click OK to finish the calculation.
    Thanks in adavance!!
    Thanks
    S!D
    Edited by: user12861418 on Apr 28, 2010 2:01 PM

  • SSO  Using Sys_Context function in Discoverer to validate

    We are using a calculation which uses the function SYS_CONTEXT('USERENV','CLIENT_IDENTIFIER') in 10G, we are now upgrading to 11G and this function does not work. Can someone direct me to what action I need to change 'Client_Identifier" to or how to make this work in 11G

    Hello
    Are you talking about upgrading Discoverer from 10g to 11g or the database from 10g to 11g?
    Also, when you say "it does not work" can you be more specific? Do you get any error messages and have you been able to test this using something like TOAD?
    Perhaps it is as simple as a missing grant to the Discoverer user? Here's the script I use, perhaps you can take a look and see if your users have the same privileges.
    accept username prompt'Enter Username: '
    accept pword prompt'Enter Password: '
    create user &username identified by &password;
    grant connect, resource to &&username;
    grant analyze any to &&username;
    grant create procedure, create sequence to &&username;
    grant create session, create table, create view to &&username;
    grant execute any procedure to &&username;
    grant global query rewrite to &&username;
    grant select any table, unlimited tablespace to &&username;
    grant execute on sys.dbms_job to &&username;
    grant select on sys.v_$parameter to &&username;
    Does this help?
    Michael

  • Functionality in Discoverer 11g to limit the users or reports that consume

    Experts,
    I am using Discoverer 10g(9.0.4) ... we are upgrading to Discoverer 11g Fusion Middleware . i want to know if there is any functionality in 11g where we can limit the resources for users or reports that they usually consume in 10g .......
    let me know if my question is not clear?

    Hello,
    If I understand your question correctly, no this is not possible. There is no tool or method to have Discoverer 11g review the 9.0.4 statistics/usage and then limit the resources based upon the 9.0.4 usage.
    You can limit the number of rows returned or set requirement to schedule worksheets that are estimated to take over specific time and other such settings. These same settings are available in 9.0.4 as well.
    Regards,
    Sharon

  • Reasons for Introducing database functions for Discoverer Reporting Needs

    Hi All,
    I would like to know the criteria other organizations have used in creating custom database functions specifically for Discoverer reporting needs. It seems good and appropriate to identify these reasons in order that they have a sufficiently good reason (e.g. in presenting this to a change management board).
    Here is a quick swipe:
    -query explain plan improvements
    -take away the complexity of having the end user deal with complex calculations
    -consistency of a value (e.g. a complex amortization calculation)
    -an attribute is used from a dependent table with a minimum cardinality of zero
    Can anyone list other good reasons in terms of Discoverer reporting?
    Thanks,
    Patrick
    Edited by: Patrick Bacon on Jul 15, 2009 10:30 AM

    Hi Patrick
    In addition to the reasons you have given the reasons for having functions anyway apply just as equally to Discoverer as they do to other applications.
    Typically the main reasons why I would use a function are:
    a) due to the complexity of the code, or
    b) to evaluate something which an end user either could not do or does not have access to.
    For example if a user needs to have aggregations from multiple tables side by side in a report, typically from tables which have no joins between them, I write functions to go get the individual results.
    One specific function that I use a lot is one that calculates the number of working days between any given two days. Some of my HR customers use such a function to calculate the number of sick days for an employee when obviously only working days should count. Doing this in a normal Discoverer calculation would be very hard. Retail customers might use this for calculating the number of days it took to ship and item.
    There are other reasons why I use functions but these are the typical ones.
    Best wishes
    Michael

  • Functions in Discoverer

    I'm working with Discoverer 3.1 and I want to create a item that show me the sum of n-values. For example:
    Location US$ FEB-2001 US$ TOTAL YEAR
    A 10 15
    B 12 21
    In this example, JAN-2001 must be 5 for Location A, and must be 9 for location B in JAN-2001. In the page item I've the time period, then I just want to show this period in the Top axis.
    How I can do that? I think that a must to create a function, but is there another way?
    I'm working on Oracle8i Database.
    Thanks
    Mario Reyes C.

    Hi,
    You can more reference on the Analytic Functions available in Oracle in the Orale 8i SQL Reference for 8.1.7 Part No. A85397-01, under SQL Functions.
    Thanks,
    Selva

Maybe you are looking for