Need help with report quering store procedure

I posted earlier today with my code, but I thought I should start a new thread and explain my scenario properly. Sorry for that.
have to find if a person visited a particular type of store, lets say pets mart in last six months. Every time a member of us go to store, the transction is saved into a database, which means that there are 100s of records for each member. I have few condition to apply (like flags). For example, if a member visited pets mart in last 6 months, we can send him cuopan for that store.
In my last code, I was using count(*) which takes for ever as everytime function is been called, it checks everything and then return more then one row. And my scenario requires only a flag kind of stuff, like either that member visited a particular store or not.
I am not sure what approach would be the best and optimised, obviously not the count one. I tried the case statment and it also returns more then one record (for each visit of the member) and I am looking for something like if it occured then Y else N.
My old code was something like that
function fnc (memberno, startdate, endate) return number as abc number;
begin
select count(*) into abc
from table a, table b
where a.zz = b.cc
and a.shop_date between startdate and endate)
and a.store_shoped in ('st01' , 'sto02' , 'sto3')
and a.store_location in ('loc1' , 'loc2');
return (abc);
end fnc;
I really appreciate if you can suggest me a better way to handle my situation.
Could someome please help me?

Something involving WHERE EXISTS or add a ROWNUM = 1 filter:
function fnc (p_memberno in number, p_startdate in date, p_enddate in date)
  return number
as
  abc number;
begin
  select count(*)
    into abc
    from dual
   where exists (select null
                   from table a, table b
                  where a.zz = b.cc
                    and ?? = p_memberno
                    and a.shop_date between p_startdate and p_enddate
                    and a.store_shoped in ('st01' , 'sto02' , 'sto3')
                    and a.store_location in ('loc1' , 'loc2'));
  return (abc);
end fnc;With either approach, the count will return only 0 or 1 and will stop at the first match it finds.

Similar Messages

  • I need help with reporting as soon as possible!

    How can I do reporting in JDeveloper like in Crystal reports. Is there any extention or tool that can be of help.
    Thanks
    Edited by: Fenoch on Mar 12, 2010 6:34 AM
    Edited by: Fenoch on Mar 12, 2010 6:36 AM

    @Fenoch,
    I'm also new to the JDeveloper world and I haven't gotten into reporting yet, but a couple I've heard about are
    Oracle BI Publisher - http://www.oracle.com/technology/products/xml-publisher/index.html
    Jasper Reports - http://www.jaspersoft.com/
    BIRT - http://www.eclipse.org/birt/phoenix/ (more of an eclipse thing I think)
    I hope that helps, I'd like to hear what you find out about any of these.
    Don't let elitist responses run you out of the community.
    @John,
    John Stegeman wrote:
    If you need help as soon as possible, why didn't you try searching the forums?
    JDeveloper doesn't have reporting capability, per se, but there are a number of Java-based reporting tools out there, which you could find [url http://www.lmgtfy.com/?q=java+reports]here
    John
    Way to be an ass to a newbie. It is posts like this (from an Oracle "Ace" Director no less) that push people away from the platform.
    Maybe you could post a link to a reporting tool you know about, instead of sounding off like an elitists jerk and belittling a new guy. I'm sure you popped into the world full of knowledge and ego, never received any help or asked any "newb" questions.
    I also find it very interesting that your "helpful" search link sends us to GOOGLE and not on a search of these forums. Could it be that the forum search is unreliable and returns garbage results most of the time?
    You could have linked a forum search -
    http://forums.oracle.com/forums/search.jspa?objID=f83&q=java+reports (Typical unhelpful results set)
    http://forums.oracle.com/forums/search.jspa?objID=f83&q=reports (Slightly better, at least has a couple posts talking about Jasper)
    Re: Report Facility
    Or if you just gotta use google at least narrow it to the forum you are suggesting we search in -
    http://www.google.com/search?hl=en&as_q=java+reports&as_epq=&as_oq=&as_eq=&num=100&lr=&as_filetype=&ft=i&as_sitesearch=http%3A%2F%2Fforums.oracle.com%2Fforums%2Fforum.jspa%3FforumID%3D83&as_qdr=all&as_rights=&as_occt=any&cr=&as_nlo=&as_nhi=&safe=images
    It is actually the low quality of the forum search tool that forces people to re-post the same questions as others have. I know I do it all the time after I've attempted multiple searches.
    TL;DR version
    Be helpful or be silent.
    Bullying the new people pushes them away and hurts the community. No new people -> no more JDeveloper.

  • Need help with Report Generation Toolkit: Excel Set Cell Format.vi

    Hi people,
    I've been searching and found this old thread of someone asking what is the input parameter "Number format". And I dont know what should I put in there. I've tried so many possibilities, but nothing works so far, such as:
    0,0
    0,?
    0,#
    #,0
    ?,0
    and also with @, doesnt works. Where would I find help about this parameter?
    I'm using Excel2003, german version, thus local decimal separator is a comma.
    I also found this help from NI, but seems doesnt help me either. Do I miss something important?
    thanks,
    Yan. 

    Hi,
    I've used your suggestion and some numbers in excel doesnt need to get "right click, change to numbers" anymore (green indicators on the left-top side in some cells are gone). But, I think its still not a number, because I cant use a simple formula, such as in cell A10 I type "= A1/2" (cell A10 equals cell A1 divided with 2) . I got error which says its not a number.
    Well, but other thing is found, any format-string I put in the input of Excel Set Cell Format.vi, such as #,########, will be shown the same as "customize #,########" if I right click in a cell in excel and click "Zellen formatieren" (formatting cell). But however, the numbers are still depends on the input of the format I put in the Append Table to Report.vi.
    regards,
    Yan.

  • Need help with report

    Hi Friend,
    I'm quite new to Oracle BI. I have managed to create a request (from the answers section) that returns desired result, my problem is the formatting requirement of my report... the thing is i need to have three sections first of which is the header with such information as timestamp, company logo etc. the second section will contain the body of the report (which i have generated from query) and the last section will be footer.
    How and where do i get the formatting power to achieve this? the dashboard seems to have very limited formatting power. Could you also point me a any documentation that could be helpful?
    Many thanks in advance

    Since no one mentioned it, I'll add this as well:
    In the Compound Layout View, in the top left corner, there is a Print and PDF button. Click it and there are options to included a HEADER and FOOTER. You can add a timestamp for the report, date, page numbers, author, etc. See if these may help you as well.

  • Need help with report by day

    I've encountered another bump in the road. Can someone point me in the right direction in order to get help creating a report based on dates input by a user?
    I have a report that keeps track of outages based on application. I now need to break down that report and display the percentage of availability for each application and by each day between the dates entered by a user.
    I have been unsuccessful at finding any information on how to get this accomplished.

    Willi, I have a question concerning your query.
    I have a start date and end date in my table that keeps track of outages based on application. How would I incorporate that into your query, in addition I am not having any luck at the breakdown by day. When I attempt to run the query changing my attributes I get a column with hours = 24 and date = the start date of my outage. Please help.

  • Need help with reporting

    I am very confused and frustrated with this whole process. I got Captivate to build a on line teaching tool for my office employees. After creating the training I found that you have to have a place to host it.  I found a web host, and made a website and uploaded the program to it.  I got captive 7 so that I could make use of the reporting tool. (I need to be able to track which employees did the training).  I then found that when I upload the results to actrobat.com, the user needs an adobe ID and password. So I went on actrobat and entered all my employees as name, and employee number @ adobe.com  It let me enter everyone of them with no issues whatsoever.  Until I had some of them try to take the training. They were able to open my training and complete the whole thing. When they went to post results it asked fro their adobe ID and password.  Armed with the ID and password I gave them it states that the Id email was not verified.  I cannot find a way to verify it.  Should be an easy way to upload employees that you need to track? Please help, I am not a computer guy, I am a safety guy and I am lost.
    RB

    I don't normally use Acrobat.com as an LMS, but from memory Adobe has some kind of email verification mechanism whereby once a person registers an email address as their Adobe ID then they receive a verification email sent to that address and they're expected to confirm they are a real person by clicking a link or something.  Is it possible that your employees did not receive this verification email or that it was picked up and ditched by your company's antivirus software thinking it was a virus?  If their email addresses were never verified then that would explain why they were not able to log in just because you set up their Adobe IDs.

  • Need help with report generation toolkit

    I'm having a really hard time finding a solution for my problem. I'm measuring a distance and a diameter simultaneously. The outcoming values have a depency and are stored in a 2-D array.  I want to export this array to an excel table and x-y-chart (distance is x and diameter y). So far I can export the data to a table, however the charts produced are useless. Can somebody please help me? I'm almost crying since I'm trying to find a solution for 3 days now.
    Additionally, after one measurement is done, the user should have the possibility to do the next measurement, and the data has to be stored in the same excel file, in another worksheet. How can I do this? 
    Attachments:
    Hauptprogramm_0.5.vi ‏129 KB

    Hi!
    If you want a nice graph in Excel based on your data you have input there, I would recommend creating a macro that builds your graph. Read more about macro, Excel and LabVIEW here. I don't have the Report Generation toolkit, but I think you can send macros with it too. 
    Regards,
    Even
    Certified LabVIEW Associate Developer
    Automated Test Developer
    Topro AS
    Norway

  • I need help with my queries of my inventory system

    I want tosubtractthe number of entrieswiththe number of outputsof my products,but I have aproblem...the result isnot correct,when
    I dothe subtractionto getthe current amount ofmy products.
    also I have several inputs and outputs of the same
    product.
    please I need your help
    select e.codpro,(sum(e.cantidad)) as productentry from entradapro e
    group by e.codpro
    select s.codpro,(sum(s.cantidad)) as productoutput from salidapro s
    group by s.codpro
    select e.codpro,(sum(e.cantidad)- sum(s.cantidad))as total from entradapro e inner join salidapro s
    on e.codpro = s.codpro
    group by e.codpro
                  

    Try this please:
    ;WITH A1 as
    SELECT e.codpro ,
    ( SUM(e.cantidad) ) AS productentry
    FROM entradapro e
    GROUP BY e.codpro
    ), A2 AS
    SELECT s.codpro ,
    ( SUM(s.cantidad) ) AS productoutput
    FROM salidapro s
    GROUP BY s.codpro
    SELECT e.codpro ,
    e.productentry - s.productoutput AS total
    FROM A1 e
    JOIN A2 s ON e.codpro = s.codpro
    sqldevelop.wordpress.com

  • Need help with Report for Lag Forecast

    Hi All,
    I need your inputs in creating a Report to show Lag Forecast.
    Forecast is done on a weekly basis. Assuming forecast is done at a time for 3 upcoming weeks, the data in the cube will be as follows:
    ZCALWEEK     CALWEEK     MATERIAL     FORECAST
    46     47     ABC     2
    46     48     ABC     3
    46     49     ABC     6
    47     48     ABC     11
    47     49     ABC     8
    47     50     ABC     14
    48     49     ABC     10
    48     50     ABC     2
    48     51     ABC     5
    49     50     ABC     4
    49     51     ABC     6
    49     52     ABC     9
    Now the calculation for lag is as follows:
    Lag1 for Week 47 = Forecast for Week 47 done in ZCALWEEK 46
    Lag2 for Week 47 = Forecast for Week 47 done in ZCALWEEK 45
    Lag2 for Week 48 = Forecast for Week 48 done in ZCALWEEK 46
    User wants to run the Report for a range of Calweeks.
    For the Selection -  Calweek: 47-49 Report should be as follows:
    CALWEEK     47          48          49     
    Material     LAG1     LAG2     LAG1     LAG2     LAG1     LAG2
    ABC     2          11     3     10     8
    To achieve this we used the variable for Calweek and offset its value.
    So Lag 1 = Forecast restricted by week 47-1
    Lag 2 = Forecast restricted by week 47-2
    This approach of offsetting variable only works for the first week that is week 47.
    In the subsequent weeks the value is offset again to the same value as first week.
    For example in Lag2 for Week 49 = Forecast for Week 49 done in ZCALWEEK 47. However the offset approach fetches value of the Forecast done in week 45.
    Please advice as to how this might be solved.
    Is it possible to show the Report for a range of weeks or is it only feasible to show data for one week at a time?
    Thanks in Advance,
    Amrita

    Create an user entry variable that computes the current lag and create replacement path variables replaced by the selection variable and the current offsets. Have you tried this approach?
    If this replacement path variable approach not working you can try calculation everything using formulas in transformations that can directly input required lags in cube itself.

  • Need help with Report Script calculation...

    When trying to implement a calculation on 2 members (sales, tax exempt) I am having a problem keeping the report from accumulating the calculation total...
    Any ideas would certainly be appreciated.
    Thanks,
    //*****Script******
    { CALCULATE ROW  "item1" OFF}     //sets variable for first calculation item
    { CALCULATE ROW  "item2" OFF}     //sets variable for second calculation item
    <row("entities", "Measures")
    //{Supoutput}
    {SETROWOP "item1" +}     //starts adding the member
    "Sales"
    {SETROWOP "item1" OFF}     //stops adding the member
    {SETROWOP "item2" +}          //starts adding the member
    "tax exempt"
    {SETROWOP "item2" OFF}     //stops adding the member
    //{OUTPUT}
    { CALCULATE ROW  "total sales" = "item1" - "item2"
    PRINTROW "total sales"}
    //*****what I am expecting******
    north      sales     777.00
    north      tax exempt     27.00
    north      total sales     750.00
    south      sales     796.00
    south      tax exempt     23.00
    south      total sales     773.00     <======     correct
    //******actualreport results******
    north     sales     777.00
    north      tax exempt     27.00
    north      total sales     750.00
    south     sales     796.00
    south      tax exempt     23.00
    south      total sales     1523.00     <==== accumulated number / wrong!
    Edited by: Adam M on Sep 29, 2011 5:06 PM

    You should do this calculation in Essbase, not in report script. Add dynamic calc member "Total Sales" with formula "Sales" - "Tax Exempt"...
    Regards,
    Yuri

  • SCCM 2007 - Need Help with report 306 -- 304 -- 170

    Hi, if you run report 306 you can select an update list to measure compliance against.
    We have an update list that we use for measuring compliance.
    The problem for me comes when you drill in.
    The first report from 306 links to 304.
    If you then drill in once more to a list of the non-compliant machines, for example, report 304 links to 170 .
    Report 170 does not filter the update list you selected in report 306. It lists all updates.
    I cannot seem to modify report 170 to only include the updates that are in a specific update list.
    Does anyone have any idea how to modify 170 to only display updates referenced in an update list?

    Ok, you start with 306 and the links are as follows:
    306 - Compliance 1 - Overall Compliance  (Software Updates - A. Compliance)
    304 - Compliance 8 - Computers in a specific compliance state for an update list <secondary> (Software Updates - A. Compliance)
    170 - Compliance 6 - Specific computer  (Software Updates - A. Compliance)
    Again, the data returned in 170 is bang on, but i am trying to have it only display the updates that are referenced in the update list i selected in 306.

  • Need help with how to store data in array in from reading file

    i have a file named xxx.txt
    i need to retreive data from that file. the data that i want to retrieve is enclosed with << >>
    temp xxx-123 ccc << 90.5>>
    haha xxx-563 sss 85.2
    after a few lines, the another record appear.
    temp2 xxx-123 ccc << 190.5>>
    haha2 xxx-563 sss 885.2
    i would like to record down the data, 90.5 & 190.5, how do i go about doing so, will appreciated it if someone would guide me along. thanks

    After you have read a line from the file either
    find the location of << and >> and substring the stuff in between or
    use regex (regular expression) however this is advanced and may be beyond your level of understanding.

  • Need help with REX queries

    Can anyone help explain behavior in the OER Extensibility Framework/REX openapi that I am seeing. I may have misunderstood the documentation and I admit I'm looking at the 11g version of the api online and using it against 10.3
    Anyway I'm trying to figure out how to query for only assets that are Registered on keywords, dates, and additional criteria.
    I know it is possible because I can see the actual UI of the product does this but I'm having different behavior.
    So from the api it led me to believe that if off of the AssetCriteria class I called setBrowsableOnly("true") it would only bring back browsable/registered assets (unless in progress flag is set). That was not filtering non-registered assets.
    So I then attempted to set up a SearchTerm where I tried both the key of the SearchTerm to be both registered as well as assetstatus, on registered key I set the value to REGISTERED and on the assetstatus I set the value to 100.
    But in all instances it is still bringing back more than registered assets.
    There are other criteria I want to set as well but I'm missing some sort of basic here.
    So example code is:
                   //Create Criteria
                   AssetCriteria criteria = new AssetCriteria();
                   //By default search browsable only assets
                   criteria.setBrowsableOnlyCriteria("true");
                   //By default do not do exact match search
                   //criteria.setExactMatchCriteria("false");
                   //Do general criteria search on provided keyword
                   criteria.setGeneralCriteria(keyword);
                   //Create SearchTerm to help get only registered assets
                   SearchTerm[] searchTermArray = new SearchTerm[1];
                   //TODO: Need to figure out what search term is needed if any for only registered
                   SearchTerm term = new SearchTerm();
                   term.setKey("/assetstatus");
                   term.setValue("100");
                   searchTermArray[0] = term;
                   criteria.setSearchTerms(searchTermArray);
                   //TODO: probably will need to remove the following code as final gets closer
                   //For testing purposes pull count right now
                   int count = repository.assetQueryCount(authToken, criteria);
                   logger.debug("Count is; " + count);
                   //Due to memory requirements pull back summary for now
                   //TODO: Figure out best approach for number of assets we will be pulling back
                   //assets = repository.assetQuery(authToken, criteria);
                   assetSummary = repository.assetQuerySummary(authToken, criteria);
    I have looked at OER103-REX_Asset.pdf so unless it is clearly spelled out in there and I keep missing it, I already know it exists. Maybe I do keep missing it in there.
    So likewise I need to understand how to query for assets that are active, retired, etc...which appears to be in the status field. But again I haven't gotten the SearchTerms to work correctly.
    Thanks,
    Diane
    Edited by: user10818227 on Jul 30, 2010 12:46 PM

    Add a class of 'hide' to the Site Links <article> tag as below:
    <article class="column hide">
    <h4>Site Links</h4>
    You already have a class of 'rightlist' for the Interested in Exclusive Articles? <article> tag so we'll use that.
    <article class="column rightlist">
    <h4 class="style4">Interested in Exclusive Articles?</h4>
    Add this media query to your css styles:
    <style>
    @media screen and (max-width: 500px) {
    .hide, .rightlist {
    display: none;
    </style>

  • Need help with Report and Forms

    I have a report that shows all the information of an employee, say sales information of that employee on page 1. when I create NEW record, it'll direct me to page 2 which is a form to fill in the details. How do I get certain fields of that form filled automatically, fields like Last Name, First Name, Employee ID?
    Thank you.
    Andy

    Can you show me the pl/sql process that you have? get
    me started off?
    Thanks,
    AndySure , See Below. Its just a PL/SQL Block. Enter it into the box named Source.
    I have a button (called reactivate in my case). This process is made conditional on the page being submitted.
    Process Point: after computations and validations
    Run process: Once per Page Visit.
    P38_CARDHOLDER_REF is an item on my form on which the SQL is based.
    declare
    v_sysdate date := sysdate;
    BEGIN
    delete
    from ci_deleted_cardholder
    where cardholder_ref = :P38_CARDHOLDER_REF
    and deleted is null;
    update bp_partner
    set disable_date = add_months(v_sysdate,5000),
    statuscode = 1,
    last_update_date = v_sysdate
    where partner_ref = :P38_CARDHOLDER_REF;
    insert into bp_partnerstathist
    (partnerstathist_id,
    partner_id,
    changeddt,
    statuscode,
    changedby,
    reasoncode,
    Signature
    values(
    bp_partnerstathist_seq.nextval,
    :P38_cardholder_ref,
    v_sysdate,
    1,
    v('APP_USER'),
    1012,
    NULL);
    COMMIT;
    END;

  • I need help with the app store ?

    My the app store said I had an update on an app so I went to go update it and it said the item you've tried to buy is no longer avaliable, but I've already purchased the app before and the app store keeps telling me I have an update, I don't know how to get rid of it, and I can't delete the app because it had heaps of things on it ?

    what happens if you restart the iphone?

Maybe you are looking for

  • Audition 3.01 suddenly wont startup

    I've been using Audition 3.01 for a couple of years with no major problems.  I'm using it mainly as a wave editing/mastering environment so there are periods of time (e.g. weeks to months) where I don't run it. Recently I tried to start the program a

  • Outlook express integration with R/3 and Portal

    Hi,     I have seen a new system setup where we can assign security group to a user in Outlook express and it will give some authorization in R/3 and Portal. I am first time seeing this concept .Can anybody pls explain me how to create the security g

  • File associations not roamed using Remote Desktop Server 2012 R2 Standard

    Hello everyone, As the title mentions, some File Associations does not seems to roam on a RDS 2012 R2 server. We use the following configuration: Windows Server 2012 R2 Remote Desktop Server(s) Roaming Profiles to a user based network share Delete ca

  • Interactive forms, WD4A, Firefox

    Hi, I have problems with displaying my interactive form in firefox. In IE everything is OK, but in firefox, there is only blank space instead of interactive form.I have ZCI layout in my form layout type. Where is problem? Thanks for any reply.

  • Disable auto-scroll when using shape tool in full screen

    I have a task that requires tracing in full screen mode on an image that is exactly the same size and resolution as the screen.  Unfortunately when I draw shapes near the edges the screen scrolls even though there is nothing more to show.  This makes