Order by clause in discoverer custom folder

hi,
i m working on discoverer 3.1.38.I've been trying to sort the period according to calendar sequence and for this i tried 2-3 different queries which are working fine on sql plus but in discoverer custome folder,one error is coming saying ..can't use ORDER BY clause in custom folder.
I've tried formatting option also but it doesn't work here with me as i preferably want to sort in MON-RR format.
thanks in anticipation
null

thanks for replying back. but i didn't get what exactly u meant by creting query in user edition and about alternative sort,i should have list of value item and item_to_sort in same folder but i don't have that..i am creating one cross tab report and using to_char(gl_date,'MON-RR') format on my top axis its' appearing alphabetically over there,i wrote one qurey which worked prefecly fine on sql plus,but in discoverer its' giving me error.i can't create alternative sort on this,so please give me some different solution
thanks in advance

Similar Messages

  • Date Parameter in Discoverer Custom Folder

    Hi All,
    We have a requirement where i need to filter sql query data in the where condition as below.
    WHERE 1=1
    AND TRANSACTION_DATE BETWEEN :PARAMETER_DATE-90 AND :PARAMETER_DATE-9
    Can anyone of you help me on achieving that in discoverer.
    Thank You
    gt0990

    Hi,
    to do that inside the custom folder you can use DB contexts, read the following :
    http://learndiscoverer.blogspot.com/2008/11/metalink-note-304192.html
    Re: Passing multiple parameters into Custom Folder...
    Tamir

  • How to Pass Multiple Parameter to Discoverer Custom Folder Created in Admin

    Hi,
    I have done as describe in doc id (metalink) note 304192.1 and it's ok.
    Now, my scope is to use the parameter declared in SETPARAMS not with the "=" condition but with "IN CLAUSE" (multipe values).
    for example (SQL Inspector):
    SELECT i106116 as E106116,i106117 as E106117,SUM(i106118) as E106118_SUM
    FROM ( SELECT DS_COMMESSA AS i106116, DS_SCENARIO AS i106117, DS_VALUE AS i106118 FROM (select ds_commessa, ds_scenario, DS_VALUE
    from dw_ods.ods_mbo_commessa
    where DS_TIPO_COSTO='COSTI MEDI'
    and ds_label='DIR'
    and cd_scenario in (1,2)
    and ds_commessa IN DW_ODS.SETPARAM.GET_PARAM1
    union all
    select 'Totale' as ds_commessa, ds_scenario, sum(DS_VALUE)
    from dw_ods.ods_mbo_commessa
    where DS_TIPO_COSTO='COSTI MEDI'
    and ds_label='DIR'
    and cd_scenario in (1)
    and ds_commessa IN DW_ODS.SETPARAM.GET_PARAM1
    group by ds_scenario
    ) CUO106102 ) o106102
    WHERE (1 IN (DW_ODS.SETPARAM.SET_PARAM1(:"Commessa")))
    GROUP BY i106116, i106117;
    where the parameter "commessa" is used with "IN" operator.
    Also tried to modifiy the SET_PARAM1 and GET_PARAM1 in order to use a "table of varchar2" ... but with no succes.
    Help please

    Rod,
    for the first "problem" I find the solution on metalink (note 304192.1) and works fine (also combining SET and GET together)... otherwise I don't know how use this "workaround"...
    for the multiple values on a single parameter (for example: Month='Jan,'Feb') I have tried to understand how DISCO pass these values to the SET function (I suppose like an array of varchar2) but don't work. After the first values (Jan) the reports stop... The problem in not how stored the values but understan how DISCO "pass/manage" these values (Jan,Feb)... Can u help me?
    my actual SETPARAMS package body is (like metalink):
    CREATE OR REPLACE PACKAGE BODY SETPARAM AS
    FUNCTION SET_PARAM1(P1 IN VARCHAR2) RETURN NUMBER IS
    BEGIN
    param1 := P1;
    return 1;
    END;
    FUNCTION GET_PARAM1 RETURN VARCHAR2 AS
    BEGIN
    return param1;
    END;
    FUNCTION SET_PARAM_MBO(p_anno IN VARCHAR2) RETURN NUMBER IS
    BEGIN
    anno := p_anno;
    return 1;
    END;
    FUNCTION GET_PARAM_MBO RETURN VARCHAR2 AS
    BEGIN
    return anno;
    END;
    END SETPARAM;
    ----------------------------------------------------------------------

  • Custom folder - basic question(s)

    Hi Everyone,
    Hope all is well...
    I am aware that one can create an
    statement and than use that to create a Discoverer custom folder.
    I was wondering when do you have a tendency to go with this approach?
    Do you do this so that you can -
    1) avoid complicated Discoverer queries - for example you want to avoid using too many analytic functions
    so you prepare the data using SQL?
    2) create a NEW Discoverer query off this custom folder
    thus this technique is like doing a query against a query
    I would like to to create a custom folder for the above 2 reasons.
    What are your opinions? tx, sandra

    Hi Sandra,
    let's clarify the terms:
    Normally you have developed your Select statement that returns the data that you need in Discoverer. Now you have two choices:
    1. send this SQL to your Disco Administrator and let him/her create a custom folder in Discoverer, where he/she uses your SQL directly (copy&paste into discoverer admin)
    2. you can use your Select statement and store it in the database and give it a name. you do this via:
    create view your_view_name
    as
    select ... from ....;
    Then you can use this view like any other table for selects:
    select * from your_view_name;
    And it will return the same results like your initial select statement. The advantage is that this view exists as an object in the DB, means everyone else can use it (for example for tests), while you as a developer maintain it.
    When you have a view, then in discoverer administrator instead of creating a custom folder you can create a "normal" folder via "New folder from Database". Then it will list all your tables and views on the database, so you select your view "your_view_name" and it will create a folder for this (each column in the view will get an item in the folder etc.)
    Regarding performance: You can not generally say that this or that performs better, since the select statement in the view and in the custom folder can be the same. However if it's in the DB as a view, then the DBA can monitor and optimize performance better, since he can see it there as an object.
    Next to that there are certain limitations to the select statements that you can use in a custom folder. You do not have these limitations in the DB Views. However those are pretty complex statements that you maybe did not miss so far...
    Regarding benefits for tests:
    The benefit with a DB view is: you create a view for your select statement and then you can ask someone else to check if it returns the correct data. They will have to do a:
    select * from your_view_name where...;
    If something is not correct, you change the view but you don't need to send them the SQL via mail again... sending SQLs via mail is something I avoid, because people always do copy&paste mistakes or the mail program does some stupid things with the code or whatever.. I prefer to keep the "implementation" (source code/select statement) hidden to the person that tests... they can validate based on the results.
    But I don't want to stress too much on this one, since normally your users should test in Discoverer, that's what they will use finally, so they should test there. And here it does not make a difference to the end users whether you have views or custom folders.
    Regarding Source Code control or "Version Control":
    We use CVS or Subversion to store our program code. So all program code is stored in such a version control system, so that you can keep track of the changes over time, see which version was installed when (we place "tags/labels" with the date of deployment on the version that is installed) etc.
    I guess you store your program code somewhere in a folder, and you use different folders for different versions or something. This is pretty nasty, CVS or Subversion or systems like this make your life easier ;)
    Regarding Automatic deployment:
    Once we have developed a certain program (statement, package, whatever) and it's working fine, then we store it as new version in our CVS (version control). Then we do a UAT (user acceptance test). IF everything is fine and approved for production, then it needs to be installed on the production server.
    For this we have a so called build&deployment system. We use ANT for this (comes from the Java community I think).
    What we do when we want to have something installed: we run a script called "build.sh" with some parameters:
    build.sh deploy_production my_project
    this means we want to deploy the program "my_project" to the production system. the rest is handled by the script:
    1. get the latest version of the program code from CVS
    2. prepare & copy all needed files to the production servers
    3. run one or more install scripts on the production servers to install everything (for example it will execute our "create view ... " script via SQLPlus)
    4. verify if installation went fine
    5. place a tag/label in CVS that this specific program version has been installed on the current date onto the production system
    You can add there some more things if you want to... of course not everything is automated at our site, for example the discoverer folders are still manually created. But this is a one time action. If you make a minor change to the DB view (no new columns) then you need to install only the new version of the View, but nothing needs to be done in Discoverer with the folder.
    Well, I could continue for a while explaining the concept more and more... But meanwhile I forgot already what the initial problem was :-D
    best regards,
    David.

  • Unable to Create a custom folder in Discoverer Administrator

    Hi,
    I have a discoverer report which is based on on standard query(Which cant be modified).The requirement is to add a new column to it which doesn't exist in that folder.I can create a custom folder and add the column to the report,but the problem is whenever i create the folder and hit the Validate SQL button it is throwing the error " *The custom SQL entered is not valid SQL statement - ORA-00942: table or view does not exist* "
    I have all the privileges for the user and when I am trying to validate the existing queries ,it is throwing the same error .
    Discoverer Version - 4 i
    Oracle Application - 11.5.9
    Appreciate your help .
    Thanks ,
    Vijay

    Hi,
    Creating new folders should be done when you are logged on as an application user.
    If your application user does not have admin access to the EUL then log on the Disco Admin as the EUL owner and grant full admin privileges to an applications user or responsibility.
    Then logon to Disco Admin with that user or responsibility. You should then be able to create and import folders.
    Rod West

  • Creation of a Custom Folder in Oracle Discoverer Administration Edition

    Hi
    Could anybody help me in solving this problem while creating a Custom Folder in Oracle Discoverer Administration Edition ?
    My Requirement is :
    I Connect to EUL_US/EUL_US@<HOST_STRING> under Oracle Discoverer Administration Edition.
    I selected a Pre-Defined Business Area Eg. General Ledger
    There i created a Custom Folder by Name Test Custom Folder
    The Query which i used in my Custom Folder is
    SELECT NAME FROM GL.GL_JE_BATCHES
    When i Used this Query it says Table or view does not exist.
    The Folder is getting created but without a Query.
    I am not able to preceed further.
    Any Help would be appreciated
    Regards
    Nakul Venkataraman

    Hi Nakul, you may be running into a problem with the sql for your custom folder. For some reason Discoverer Admin will allow you to create a custom folder with sql, but then if you change it and it has any advanced sql, i.e. grouping sets, analytic functions etc., you probably receive an error.
    An option is to create a view using the same sql and create a folder from the database using this view.
    Hope this helps.
    Brent.

  • Passing parameter to a query in Discoverer Admiin custome folder.

    I am developing a report in which I need to paa in the request Id as parameter to display the user the data corresponding to that request Id. However the query is very complex and If I am enetering the request Id in Discoverer Desktop se as Condition for the workbook created the report takes a lot of time to generate. Is there any mechanism through which I can pass the parameter directly to the Custome folder query. As this will reduce my computation time since all the joins will be done only for the rows with that given request Id rather than for all the rows which is happenning correctly.
    Thanks.

    Hi,
    Well there is no straight forward way to do that.
    There is a work around to get that functionality by using outer tables or context.
    Take a look at the following posts:
    Re: Parameters in SubQuery
    Re: Parameters in Discoverer Administration
    Re: Passing multiple parameters into Custom Folder...

  • Performance for Custom folder in Discoverer

    Hi there, thanks for all your helping questions and sharing your thoughts.
    I got issue from user regarding Custom folder in Discvoerer while they try to run report, becoz there are item classes i created and its taking so long time to fetch LOVs.
    Below is the query, I used to create custom folder and also created 3 LOVs (item classes) in Discverer Administrator, it is working well and good.
    According to the requirement ( you can see bottom of this page) this is the query, Can anyone help me on how to improve performance, in TOAD the query takes long time, so for Item classes also it takes long time. Any ideas would be greatly appreciated, thanks in advance.
    SELECT fu.user_name
    , fu.description
    , fu.start_date "User Start Date"
    , fu.end_date "User End Date"
    , frv.responsibility_name
    , frv.start_date "Resp Start Date"
    , frv.end_date "Resp End Date"
    , furg.start_date "Resp Assignment Start Date"
    , furg.end_date "Resp Assignment End Date"
    , MAX (flr.start_time) AS "Last Logon"
    , 'Y' as "Logon Flag"
    FROM apps.fnd_user_resp_groups_direct furg
    , apps.fnd_responsibility_vl frv
    , applsys.fnd_user fu
    , applsys.fnd_logins fl
    , applsys.fnd_login_responsibilities flr
    WHERE furg.responsibility_id = frv.responsibility_id
    AND fu.user_id = furg.user_id
    AND fl.user_id = fu.user_id
    AND flr.responsibility_id = frv.responsibility_id
    AND fl.login_id = flr.login_id
    GROUP BY fu.user_name,
    fu.description,
    fu.start_date,
    fu.end_date,
    frv.responsibility_name,
    frv.start_date,
    frv.end_date,
    furg.start_date,
    furg.end_date
    UNION ALL
    SELECT fu.user_name
    , fu.description
    , fu.start_date "User Start Date"
    , fu.end_date "User End Date"
    , frv.responsibility_name
    , frv.start_date "Resp Start Date"
    , frv.end_date "Resp End Date"
    , furg.start_date "Resp Assignment Start Date"
    , furg.end_date "Resp Assignment End Date"
    , NULL AS "Last Logon"
    , 'N' as "Logon Flag"
    FROM apps.fnd_user_resp_groups_direct furg
    , apps.fnd_responsibility_vl frv
    , applsys.fnd_user fu
    WHERE furg.responsibility_id = frv.responsibility_id
    AND fu.user_id = furg.user_id
    AND (fu.user_id, frv.responsibility_id ) NOT IN (
    SELECT fl.user_id, flr.responsibility_id
    FROM applsys.fnd_logins fl,
    applsys.fnd_login_responsibilities flr
    WHERE fl.login_id = flr.login_id)
    Requirement================
    We have made use of modifications to a Discoverer report called 'Oracle Users and Responsibilities'. We use the report to review Oracle users and their associated responsibilities. We would like to see if it would be possible to make another report with fields from the above SQL query. The intent is to note when users last made use of a responsibility (last logged on with a responsibility). The above query needs some revision in the fact that it currently only returns responsibilities a user has logged in with. Ideally, we would like to also return the responsibilities a user has not logged in with. If a date parameter is supplied for a report, the end-user will be able to return all users, their responsibilities, and the last time the users logged in. The attached query can specify a user or the user's creation date; ideally, one would also be able to only pick responsibilities user(s) had prior to a specified date. Thus, if they wished to run a report to return all the users and the last time they logged in with their responsibilities if they have had the responsibility for at least 90 days, he could readily do so.

    Hi,
    You could try this query, but whether it will be quicker depends on how you are using the custom folder in your reports.
    SELECT ilv.user_name
    , ilv.user_id
    , ilv.description
    , ilv."User Start Date"
    , ilv."User End Date"
    , ilv.responsibility_name
    , ilv.responsibility_id
    , ilv."Resp Start Date"
    , ilv."Resp End Date"
    , ilv."Resp Assignment Start Date"
    , ilv."Resp Assignment End Date"
    , ilv_login.start_time "Last Logon"
    , NVL2(ilv_login.user_id, 'Y','N') "Logon Flag"
    FROM (
    SELECT fu.user_name
    , fu.user_id
    , fu.description
    , fu.start_date "User Start Date"
    , fu.end_date "User End Date"
    , frv.responsibility_name
    , frv.responsibility_id
    , frv.start_date "Resp Start Date"
    , frv.end_date "Resp End Date"
    , furg.start_date "Resp Assignment Start Date"
    , furg.end_date "Resp Assignment End Date"
    FROM apps.fnd_user_resp_groups_direct furg
    , apps.fnd_responsibility_vl frv
    , applsys.fnd_user fu
    WHERE furg.responsibility_id = frv.responsibility_id
    AND fu.user_id = furg.user_id
    ) ilv
    ,(SELECT fl.user_id
       , flr.responsibility_id
       , MAX(flr.start_time) start_time
    FROM applsys.fnd_logins fl
    , applsys.fnd_login_responsibilities flr
    WHERE fl.login_id = flr.login_id
    GROUP BY fl.user_id
       , flr.responsibility_id) ilv_login
    WHERE ilv.user_id = ilv_login.user_id(+)
    AND ilv.responsibility_id = ilv_login.responsibility_id(+)Rod West

  • Importing Custom folder in Discoverer Administrator from One Instance to Another Instance

    Hi all,
    I have created a custom folder XXHR_TEST_FOLDER_OLM in Discoverer Administrator 10.1.2.1 in my test instance. I want to move it to another instance say UAT. First i exported the folder from test instance. File-> Export -> Selected Objects in the End User Layer->Selected Custom folder->Provided Save location and finish. The eex file is created in my local machine. Now I tried to import the same to the UAT instance. File-> Import. It throws me an warning stating
    "A folder named 'XXHR_TEST_FOLDER_OLM' was created or modified during the import but is not in a business area". What am i missing here. Kindly let me know.
    Regards,
    Pradeep

    Vinay,
    For deploying pages to Production instance , you need import these pages with help with oracle.jrad.tools.xml.importer.XMLImporter command. Check old thread in this reference .
    Thanks

  • How to pass parameter in where clause in custom folder?

    I have the follow query
    blue color are the parameters
    i have paste this to a custom folder
    and
    select last_update_date, creation_date
    from ra_customer_trx_all
    where trunc(last_update_date)='29-SEP-2012'
    and customer_trx_id=1109
    to another custom folder returning 1 row only and create another worksheet in the same workbook and create
    3 parameter and 2 of them pointing to the 1 row query and create calcualtion
    SET_CONTEXT('Date_From',TO_CHAR(:Date From)) and SET_CONTEXT('Date_TO',TO_CHAR(:Date To))
    and 1 condition 1= SET_PARAM3(:Period)
    but this doesnt work for me, no data return please help
    select m.party_name TENANT_NAME 
    , b.interface_line_attribute10 lease_num
    --, b.interface_line_attribute12 "PPS Number" 
    ,b.interface_line_attribute2 LOCATION_CODE
    ,flexv.description property_name
    , a2.trx_number INVOICE_NUMBER
    --, t.name "Transaction Type" 
    --, e.attribute15 "AS400 Key" 
    , b2.description "BILL_ITEM_INVOCIE_DESCRIPTION" 
    ,case when gcc.segment5 like '6%' then 'P/L'
    when gcc.segment5 like '7%' then 'P/L'
    when gcc.segment5 like '8%' then 'P/L'
    when gcc.segment5 like '9%' then 'P/L'
    else 'B/S'
    end as account_nature
    --, gcc.concatenated_segments as "Charge Account" 
    ,gcc.segment1 company_code
    ,gcc.segment2 department_code
    ,gcc.segment3 property_code
    ,gcc.segment4 business_segment
    ,gcc.segment5 account_code
    ,gcc.segment6 project_code
    ,gcc.segment7 intercom_code
    ,gcc.segment8 spare1
    ,gcc.segment9 spare2
    , b2.extended_amount BILL_ITEM_INVOICE_AMOUNT
    ,to_char(substr(ps.gl_date,4,8)) gl_period
    , b.interface_line_attribute11 bill_start_date
    , b.interface_line_attribute14 bill_end_date 
    , decode(a2.invoicing_rule_id, '-2',  
       DECODE(TO_CHAR(b.RULE_START_DATE, 'YYYYMM'), to_char(to_date(to_char(TRUNC(to_date(SETPARAM.GET_PARAM3,'yyyymm') , 'Month')-1),'DD-MON-YYYY'),'YYYYMM'), 'Current', 'In Advance'), 
       'Current') bill_nature 
    , to_char(a2.trx_date, 'DD-MON-YYYY') invoice_date
    ,pal.lease_commencement_date
    ,pal.lease_termination_date
    ,h.user_name created_by
    --, NULL as remarks 
    from ra_customer_trx_all a 
    , ra_customer_trx_lines_all b 
    , pn_leases_all d 
    , pn_tenancies_all e 
    , hz_cust_accounts l 
    , hz_parties m 
    , fnd_user h 
    , ar_payment_schedules_all ps 
    , RA_CUST_TRX_LINE_GL_DIST_ALL dist 
    , gl_code_combinations_kfv gcc 
    , AR_RECEIVABLE_APPLICATIONS_all app 
    , ra_customer_trx_all a2 
    , ra_customer_trx_lines_all b2 
    , RA_CUST_TRX_TYPES_all t 
    , fnd_flex_values_vl flexv
    ,pn_lease_details_all pal
    where  
    app.APPLICATION_TYPE = 'CM' 
    and flexv.flex_value=gcc.segment3
    and flexv.FLEX_VALUE_SET_ID=1014916
    and pal.lease_id=d.lease_id
    and app.applied_customer_trx_id = a.customer_trx_id 
    and app.customer_trx_id = a2.customer_trx_id 
    and a2.cust_trx_type_id = t.cust_trx_type_id(+) 
    and a2.org_id = t.org_id(+) 
    and b.customer_trx_line_id = b2.previous_customer_trx_line_id 
    and dist.CUSTOMER_TRX_LINE_ID = b2.CUSTOMER_TRX_LINE_ID 
    and dist.account_class = 'REV' 
    and dist.account_set_flag = DECODE(NVL(a2.invoicing_rule_id,1), -2, 'Y', 'N') 
    and gcc.CODE_COMBINATION_ID(+) = dist.CODE_COMBINATION_ID 
    and b.interface_line_attribute10 = d.lease_num 
    and d.lease_id = e.lease_id 
    and e.primary_flag = 'Y' 
    and b2.customer_trx_id = a2.customer_trx_id 
    and a2.bill_to_customer_id = l.cust_account_id 
    and l.party_id = m.party_id 
    and a2.created_by = h.user_id 
    and ps.customer_trx_id = app.customer_trx_id 
    and ps.gl_date between trunc(trunc(TO_DATE(SYS_CONTEXT('DISCO_CONTEXT','Date_From')),'MM')-1,'MM') and trunc(TO_DATE(SYS_CONTEXT('DISCO_CONTEXT','Date_To')),'MM')-1

    What exactly is wrong with the results? Can you make the report include the gl_date so that you can see exactly what is being included?
    The only way to troubleshoot this is to go back to basics. You have to be 100% certain that the parameter and calculations for the dates are working. You have granted execute permission over the function to your EUL owner - yes? What I did was create the function in a package owned by EUL_US then I had no issue with grants or permissions.
    Also, gl_date is a DATE and not a string right? I ask because if it is not a date but a string then some dates might be left out.
    Assuming you are 100% certain of the building blocks you should start by including only the gl_date and primary key from the table you are using. Once you are sure you are getting the right data you can start to add in more fields.
    I do notice you are using E-Business Suite objects. I copied the code into my system where I am not using leasing. So I commented out the references to the 3 PN tables. I got 150 rows of data when I queried using the parameter and again when I hard coded the BETWEEN for the gl_date. You do have to make sure that your EUL owner has been granted SELECT right from all the tables and views used in your code and, if you intend to share this code with someone else, you will also need to have GRANT rights.
    Try your code in a SQL tool such as TOAD and see what happens. Are you absolutely sure that every one of your transactions has an entry in the PN tables? This might be why you are not getting the results you expect. You could try, as I did, to comment those lines out and then see what happens.
    Hope this has given you enough to solve your issue
    Michael
    PS. It would be nice to know your name. You haven't used it once in your thread.

  • Parameter value in sql statement (Custom Folder)

    Hi ,
    I want to formulate a custom folder - consisting of a sql statement , inside of which there is a parameter. Then in Desktop , the users can select a number as the searching criteria and this value will replace the parameter in sql statement , as in the following:
    select CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE , SUM_POSOTITA from
    select CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE , SUM_POSOTITA , row_number() over (order by sum_posotita desc) rw  from
      (SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES ,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_AT_SINT_CLINIC A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS))
      where rw<=&p
      order by SUM_POSOTITA desc The problem is that the use of parameter , whereas in sql*plus is valid, in Discoverer is not....
    What can i do in this situation...????
    Thanks , a lot
    Simon

    However , a peculiar event happens....
    whereas the sql statement is:
    select CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE , SUM_POSOTITA,RW from
    select CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE , SUM_POSOTITA , row_number() over (order by sum_posotita desc) rw  from
      (SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES ,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_AT_SINT_CLINIC A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS
      UNION ALL
      SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_AT_SINT_EX_IATR A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS
      UNION ALL
      SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_AT_SINT_FOREON_MS A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS
      UNION ALL
      SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_GEN_SINT_KLIN A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS
      UNION ALL
      SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES,SUM(POSOTITA) SUM_POSOTITA
              FROM  EKTELESI_GEN_SINT_EX_IATR A, MITROO_FARMAKOU B
               WHERE CODE_FARMAKOU = FARMAK_CODE
               GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS))
      order by RW ascand produces the results....
    CODE_FARMAKOU                            EMP_NAME                                                                         PACKTYPE                     PACKSIZE                  SUM_POSOTITA         RW
    1000003279                               MOXACEF                                                                          BT                           40(BLIST10X4)                       45          1
    0000014071                               DOPAMINE HYDROCHLORIDE                                                           VIAL                         5 ML X 25                           30          2
    1000016655                               KABIVEN                                                                          BT                           50ÖÕÓ.×1,7ML                        21          3
    1000014127                               DEPON VIT. C                                                                     BT                           2TUBX10                              6          4
    0000002419                               FACTREL INJECTION                                                                VIAL                         2 ML                                 5          5
    0000086289                               DETUSSIN EXPECTORANT                                                             BOT                          120 ML                               3          6
    1000016655                               KABIVEN                                                                          BT                           50ÖÕÓ.×1,7ML                         2          7
    1000014127                               DEPON VIT. C                                                                     BT                           2TUBX10                              2          8
    1000000760                               DEPON                                                                            BT                           20(BLIST2X10)                        2          9
    1000003279                               MOXACEF                                                                          BT                           40(BLIST10X4)                        1         10
    1000003279                               MOXACEF                                                                          BT                           40(BLIST10X4)                        1         11
    1000000760                               DEPON                                                                            BT                           20(BLIST2X10)                        1         12
    12 rows selectedIn Discoverer , even i select to see -as parameter- let's say the 10 first records, the system displays the 7 first records , whereas when i want to see the 1,2,3,4,5,6,7 first records the system works fine....and displays accordingly 1,2,3,4,5,6,7 first records. The problem occurs above the 8th record-as parameter selected..!!!!!
    I defined the parameter as :Rw<=:Rw
    What may be the problem...????
    SORRY!!!!! I FOUND THE PROBLEM ....!!!!
    Regards and many thanks,
    Simon
    Message was edited by:
    sgalaxy

  • Discoverer Custom SQL Report with Group By,Having

    Hi all,
    I'm working with Discoverer 4.1.41.05 and retrieve data from Oracle HRMS.
    I want to create a report based on a custom SQL Folder in Discoverer Administration to solve the following scenario:
    SELECT EMPLOYEE_NUMBER FROM PER_ALL_PEOPLE_F
    MINUS
    SELECT EMPLOYEE_NUMBER FROM PER_ALL_PEOPLE_F,PER_EVENTS, PER_BOOKINGS
    GROUP BY EMPLOYEE_NUMBER
    HAVING SUM(PER_EVENTS.ATTRIBUTE1) >= 10)
    The problem is when I run the sql from SQL*Plus is working fine producing the correct result.
    When I create the Custom Folder and create a Discoverer report based on it I retrieve all employees since the second select statement retrieve no rows!
    Does anyone has any idea how I can solve this problem or if there is another way to create this scenario?
    Any feedback is much appreciated.
    Thanking you in advance.
    Elena

    Hi Elena,
    I think you are missing some joins, you could try something like:
    SELECT EMPLOYEE_NUMBER FROM PER_ALL_PEOPLE_F p
    WHERE NOT EXISTS
    (SELECT NULL
    FROM PER_EVENTS e, PER_BOOKINGS b
    WHERE b.person_id = p.person_id
    AND e.event_id = b.event_id
    GROUP BY b.person_id
    HAVING SUM(e.ATTRIBUTE1) >= 10)
    Rod West

  • JPQL - No UPPER() in ORDER BY clause??

    I have created a NamedQuery and am attempting to order my returned collection using the ORDER BY clause, however, the specification asks for string ordering to be case insensitive. It seems that I cannot do that with the Java Persistence Query Language - or at least the implementation that we are using. I am using Glassfish v2ur2 with uses Oracle TopLink Essentials - 2.0.1, Build b04-fcs (found in my Exception message).
    I suspect that the only way to do what I want is to create a Comparator for the ResultList and run a sort after I get the result list from my EntityManager. Is that correct or is my syntax wrong in my JPQL?
    Here is my named query (cut from a larger list of named queries), pretty simple:
    @NamedQuery(name = "MyObject.findAll", query = "SELECT a FROM MyObject a ORDER BY UPPER(a.myString), a.Id")Here is a summary exception report that I receive:
    ===========================================================================
       Exception: javax.ejb.EJBException
       Description: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
            java.rmi.RemoteException: null; nested exception is:
            Exception [TOPLINK-8024] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.excepti
    ons.EJBQLException
    Exception Description: Syntax error parsing the query [MyObject.findAll: SELECT a FROM MyObject a WHERE ORDER BY UPPER(a.myString), a.Id], line 1, column 81: syntax error at [UPPER].
    Internal Exception: line 1:81: expecting IDENT, found 'UPPER'
    (Stack-Trace Included)
    ===========================================================================

    Post Author: krypton
    CA Forum: Data Connectivity and SQL
    Thanks Lynn
    I tried your suggestion. But there is one probelm.
    When i sort the data in descending order using the count(calls) field, the data is returned but the customer's name appears multiple times along with their calls raised.
    E.g, if customer Mark raised multiple calls i.e. 2, 5, and 10 calls, then the report will show
    Mark   2
    Mark  5
    Mark 10
    But is there a way to aggregate all the calls for mark and show them only once:
    such as Mark   17
    Thanks

  • Sql count function in order by clause

    Post Author: krypton
    CA Forum: Data Connectivity and SQL
    Hi Guys
    Can i ask a quick question. I am trying to retrieve data remotely from a SQL Server via crystal reports.
    Within the Database Expert I have entered a SQL query to retrive the number of (call center) support calls raised by our customers:-
    Select `Primary_Company`, COUNT(`Calls`)From  `SPRT_Issue` GROUP BY  `Primary_Company`ORDER BY  COUNT(`Calls`) desc
    The customer's column is called 'Primary Company' and the calls they raise are in the 'Calls' column. the above is a normal sql query.
    However Crystal fails to run the query and generates an error message :-
    Failed to open a rowset. Details: 420: Driver&#93; Expected lexical element not found: <identifier>
    I dont understand why it wont run. In the ORDER BY clause if i replace field 'Calls' by the field 'Primary Company' then it works.
    I think the problem is that it wont accept the count function in the order by clause. which is what i want it to do i.e display the calls in descending order by each customer.
    Could someone tell me if there is a way around it.
    Thanks
    Krypton

    Post Author: krypton
    CA Forum: Data Connectivity and SQL
    Thanks Lynn
    I tried your suggestion. But there is one probelm.
    When i sort the data in descending order using the count(calls) field, the data is returned but the customer's name appears multiple times along with their calls raised.
    E.g, if customer Mark raised multiple calls i.e. 2, 5, and 10 calls, then the report will show
    Mark   2
    Mark  5
    Mark 10
    But is there a way to aggregate all the calls for mark and show them only once:
    such as Mark   17
    Thanks

  • Item based on a formula in a custom folder

    Hi, actually I'm using Discoverer 4i and I have a problem when I create (with the administrator) an item based on a formula inside a custom folder.
    The item is based on the following formula :
    GET_THRESHOLD(Name,'XXI_SZF_SLA_Thresholds_Kormos') -- (1)
    where:
    GET_THRESHOLD is a function that returns a number
    Name is the first parameter (and at the same time another item of the custom folder)
    'XXI_SZF_SLA_Thresholds_Kormos' is an hardcoded value.
    So..when I wrote the formula into the Item Properties, this is written correctly and when I connect with Desktop or Viewer my report works correctly.
    But when I close and I re-open the administrator, I see the following formula
    GET_THRESHOLD(Name,'XXI') -- (2)
    .....how it was saved in a wrong way....or truncated....
    I tried to check also the flag "Automatically save changes after each edit"....but I see always, after I reopened the administrator, the formula (2) and not the formula (1)
    Is seems that my changes are not saved !!
    Is this a bug ? Can I fix it in some way ?
    Thanks in advance
    Alex

    hi,
    1. Try to execute the function manually by passing the same value.
    2. Discoverer formats the names of Items/folders/parameters etc by replacing underscores ("_") with a space, so this might be the reason, why it converts the value to : 'XXI SZF SLA Thresholds Kormos' and takes only the first string "XXI".
    3. Try passing a value without "_".
    Hope this helps!
    Yogini

Maybe you are looking for

  • How to upload multiple files into a server location at a single time

    Hi All, In my application i need to send multiple files from a particular page into the server location. In this page there will be an option to upload a file and after selecting the file , we will have an option asking if we were interested to send

  • Using xmldom.freeDocument

    Oracle 8.1.7, PL/SQL I wrote a function to return a node list from a clob. The code is as follows: FUNCTION fcn_Get_Node_List ( p_clobXML clob, p_vcPath VARCHAR2) RETURN sys.xmldom.DOMNodelist AS v_docParse xmldom.DOMDocument; v_nlNodeList xmldom.DOM

  • Set path to folder?  (Save cURL to folder) [Applescript]

    I need to save a cURled file to a certain spot.  I'm really bad at this, so I'm probably missing something obvious.  here is my script: set username to short user name of (system info) set targetpath to POSIX path of (path to "Macintosh HD:Users:" &

  • Photo ID in email

    How do you remove a photo that appears on your outgoing mail?

  • Rolling title flicker in PE11 DVD playback

    Hi. I'm a mostly successful user of PE11 for Mac (graduated unceremoniously from PE10). This question is about flickering despite the flicker filter being fully deployed. It seems this phenomenon is harder to suppress in PE11 than in 10? Specifically