Getting a subset of results.

I am hoping someone can help me on this, because i really see no other way to do what i need to do.
Is there ANY way, to be able to return ONLY the first X records of a SQL statement... say for example the first 5 records, or the first one record. I am looking for something akin to MS Access' "TOP" functionality.
I have a Single-Row Returning Multiple Rows error, in some legacy code, but the data is needed as is, for other apps, but for this one, we need only the first row, because its being used in an UPDATE.
Any help is greatly Appreciated. Thanks in advance.!!
Cheerz,
Aaron.

If you care which row you get, make sure you use an order by in a sub-query. See the fifth entry on the FAQ home page for details:
Re: How to attach a java bean in forms6i
Also, it sounds like you might be doing your update the hard way. If you post the complete code, we might be able to find a more efficient method.

Similar Messages

  • How to get total number of result count for particular key on cluster

    Hi-
    My application requirement is client side require only limited number of data for 'Search Key' form total records found in cluster. Also i need 'total number of result count' for that key present on the custer.
    To get subset of record i'm using IndexAwarefilter and returning only limited set each individual node. though i get total number of records present on the individual node, it is not possible to return this count to client form IndexAwarefilter (filter return only Binary set).
    Is there anyway i can get this number (total result size) on client side without returning whole chunk of data?
    Thanks in advance.
    Prashant

    user11100190 wrote:
    Hi,
    Thanks for suggesting a soultion, it works well.
    But apart from the count (cardinality), the client also expects the actual results. In this case, it seems that the filter will be executed twice (once for counting, then once again for generating actual resultset)
    Actually, we need to perform the paging. In order to achieve paging in efficient manner we need that filter returns only the PAGESIZE records and it also returns the total 'count' that meets the criteria.
    If you want to do paging, you can use the LimitFilter class.
    If you want to have paging AND total number of results, then at the moment you have to use two passes if you want to use out-of-the-box features because LimitFilter does not return the total number of results (which by the way may change between two page retrieval).
    What we currently do is, the filter puts the total count in a static variable and but returns only the first N records. The aggregator then clubs these info into a single list and returns to the client. (The List returned by aggregator contains a special entry representing the count).
    This is not really a good idea because if you have more than one user doing this operation then you will have problems storing more than one values in a single static variable and you used a cache service with a thread-pool (thread-count set to larger than one).
    We assume that the aggregator will execute immediately after the filter on the same node, this way aggregator will always read the count set by the filter.
    You can't assume this if you have multiple client threads doing the same kind of filtering operation and you have a thread-pool configured for the cache service.
    Please tell us if our approach will always work, and whether it will be efficient as compared to using Count class which requires executing filter twice.
    No it won't if you used a thread-pool. Also, it might happen that Coherence will execute the filtering and the aggregation from the same client thread multiple times on the same node if some partitions were newly moved to the node which already executed the filtering+aggregation once. I don't know anything which would even prevent this being executed on a separate thread concurrently.
    The following solution may be working, but I can't fully recommend it as it may leak memory depending on how exactly the filtering and aggregation is implemented (if it is possible that a filtering pass is done but the corresponding aggregation is not executed on the node because of some partitions moved away).
    At sending the cache.aggregate(Filter, EntryAggregator) call you should specify a unique key for each such filtering operation to both the filter and the aggregator.
    On the storage node you should have a static HashMap.
    The filter should do the following two steps while being synchronized on the HashMap.
    1. Ensure that a ConcurrentLinkedQueue object exists in a HashMap keyed by that unique key, and
    2. Enqueue the total number count you want to pass to the aggregator into that queue.
    The parallel aggregator should do the following two steps while being synchronized on the HashMap.
    1. Dequeue a single element from the queue, and return it as a partial total count.
    2. If the queue is now empty, then remove it from the HashMap.
    The parallel aggregator should return the popped number as a partial total count as part of the partial result.
    The client side of the parallel aware aggregator should sum the total counts in the partial result.
    Since the enqueueing and dequeueing may be interleaved from multiple threads, it may be possible that the partial total count returned in a result does not correspond to the data in the partial result, so you should not base anything on that assumption.
    Once again, that approach may leak memory based on how Coherence is internally implemented, so I can't recommend this approach but it may work.
    Another thought is that since returning entire cached values from an aggregation is more expensive than filtering (you have to deserialize and reserialize objects), you may still be better off by running a separate count and filter pass from the client, since for that you may not need to deserialize entries at all, so the cost on the server may be lower.
    Best regards,
    Robert

  • Get Image Subset VI ignores original image offset

    Hi,
    I'm have a problem with Get Image Subset VI.
    My program gets original image rectangle from a image and apply a offset for draw in a picture control.
    But the image cannot across a region delimited by another rectangle. So, i use Get Image Subset with a
    image (with offset) and a deilimiter rectangle. 
    I give the same subset of image with and without offset.
    Attachments:
    test3.vi ‏12 KB
    servidor_g.png ‏3 KB

    In my opnion the correct result is the highlighted are in the Original Picture With Offset (See attached image ) and not Image Subset.
    Attachments:
    imagem.GIF ‏20 KB

  • So, I made my account a while ago before I had an iPhone so I can get music. The result of that I can't remember my security questions, and it tells me to send a rescue email an alert, but it doesn't show you how to get to that page. Can someone help me?

    So, I made my account a while ago before I had an iPhone so I can get music. The result of that I can't remember my security questions, and it tells me to send a rescue email an alert, but it doesn't show you how to get to that page. I am getting quite annoyed because apples hours arent the best fitted to my scedule since I have school and work, so I cant call and ask how to get fixed. Please help me all I want to do is buy some music...

    Click here and fill out the form.
    (90729)

  • Get ALV Report's Result Into Internal Table

    Hello everyone,
    is there a way to get a alv reports result into an internal table?
    For example: is it possible to get the values from transaction S_ALR_87012078.
    I mean i want to write a function an it will give you the alv reports result as internal table, so  you won't have to dig the reports code in.
    thanks to any answers from now. bye.

    Hi
    This is a wrapper program which will execute the standard program and capture the output as we are using list to memory
    Then after we will be using LIST_FROM_MEMORY and 'LIST_TO_ASCI'
    submit rhrhaz00 exporting list to memory
    and return
    with pchplvar = pchplvar
    with pchotype = pchotype
    with pchobjid in pchobjid
    with pchsobid in pchsobid
    with pchseark = pchseark
    with pchostat = pchostat
    with pchistat = pchistat
    with pchztr_d = pchztr_d
    with pchztr_a = pchztr_a
    with pchztr_z = pchztr_z
    with pchztr_m = pchztr_m
    with pchztr_p = pchztr_p
    with pchztr_y = pchztr_y
    with pchztr_f = pchztr_f
    with pchobeg = pchobeg
    with pchoend = pchoend
    with pchtimed = pchtimed
    with pchbegda = pchbegda
    with pchendda = pchendda
    * with pchwegid = pchwegid
    * with pchsvect = pchsvect
    * with pchdepth = pchdepth
    with infty in infty
    with subty in subty
    with vdata = vdata
    with info = info.
    data: list like abaplist occurs 0 with header line.
    data: txtlines(1024) type c occurs 0 with header line.
    clear list.
    refresh list.
    clear tbl_reportlines.
    refresh tbl_reportlines.
    call function 'LIST_FROM_MEMORY'
    tables
    listobject = list
    exceptions
    not_found = 1
    others = 2.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    call function 'LIST_TO_ASCI'
    * EXPORTING
    * LIST_INDEX = -1
    * WITH_LINE_BREAK = ' '
    * IMPORTING
    * LIST_STRING_ASCII =
    * LIST_DYN_ASCII =
    tables
    listasci = txtlines
    listobject = list
    exceptions
    empty_list = 1
    list_index_invalid = 2
    others = 3
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    else.
    tbl_reportlines[] = txtlines[].
    call function 'LIST_FREE_MEMORY'.
    endif.
    Here is the simple example program
    *Example Code (Retrieving list from memory)
    DATA BEGIN OF itab_list OCCURS 0.
    INCLUDE STRUCTURE abaplist.
    DATA END OF itab_list.
    DATA: BEGIN OF vlist OCCURS 0,
    filler1(01) TYPE c,
    field1(06) TYPE c,
    filler(08) TYPE c,
    field2(10) TYPE c,
    filler3(01) TYPE c,
    field3(10) TYPE c,
    filler4(01) TYPE c,
    field4(3) TYPE c,
    filler5(02) TYPE c,
    field5(15) TYPE c,
    filler6(02) TYPE c,
    field6(30) TYPE c,
    filler7(43) TYPE c,
    field7(10) TYPE c,
    END OF vlist.
    SUBMIT zreport EXPORTING LIST TO MEMORY.
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = itab_list
    EXCEPTIONS
    not_found = 4
    OTHERS = 8.
    CALL FUNCTION 'LIST_TO_ASCI'
    EXPORTING
    list_index = -1
    TABLES
    listasci = vlist
    listobject = itab_list
    EXCEPTIONS
    empty_list = 1
    list_index_invalid = 2
    OTHERS = 3.
    IF sy-subrc NE '0'.
    WRITE:/ 'LIST_TO_ASCI error !! ', sy-subrc.
    ENDIF.
    Re: alv to internal table

  • How can i get the time and result together show in one Array or in Cluster?

    hello everyone i am a new user .I want to get the time and voltge form a Generater. How can i get the time and result together show in one Array or in Cluster?When i selecte the first(or third...) result then in the front panel display the time and the voltge.Thank you!
    I post the time and voltge NOT together photo
    Attachments:
    12345.GIF ‏54 KB

    You can create an array of clusters with one element being the time and the other being the voltage, like so (using the "Get Waveform Components" function):
    Message Edited by smercurio_fc on 10-17-2007 03:15 PM
    Attachments:
    pic.PNG ‏11 KB

  • Getting running total formula result at the beginning of the report

    Hello All,
    I am having an inquiry that if I can get a grand total in the report footer to the report header.
    The grand total is not a direct sum.  I am using three formulas
    the first formula:
    @reset Group Header
    whileprintingrecords;
    numbervar sumpct4;
    if not inrepeatedgroupheader then
    sumpct4 := 0;
    the second formula: Details section
    whileprintingrecords;
    numbervar sumpct4 := sumpct4 + {@Total_Market};   // {@Total_Market}; =  Amount+ Interest
    numbervar grtotal4 := grtotal4 + {@Total_Market};
    Group Footer
    whileprintingrecords;
    numbervar sumpct4;
    Report Footer
    whileprintingrecords;
    numbervar grtotal4;
    All that I need is to show the total which is in the report footer at the top of the page where I am having a summary.
    So, can you please help me.
    Thanks
    Edited by: maas maas on Sep 8, 2010 12:48 PM

    Hello my friend,
    I want this to be controlled in crystal.
    Is there is a way to get the grand total by using multiple formulas or any other way?
    Here is the structure of my report:
    Group Header 1: CCY
    Group Header 2:Type
    @reset Group Header
    whileprintingrecords;
    numbervar sumpct4;
    if not inrepeatedgroupheader then
    sumpct4 := 0;
    Group Header 3A: Deal No
    Group Header 3B: Deal No (subreport to get the {@amount} for each deal)
    I will pass the end_date from the main report to subreport and I will get the sum(amount) for each deal between date (1-1-2008) to end_date. The sum will be as a shared variable to the {@amount} formual in the main report.
    Details:
    Deal No, {@amount}, {@Price}, {@market}, {@Total_Market}
    {@Price}: if {table.price} = 0 then
    100
    else {table.price}
    {@market}: if Type <> "DEP" then
    ({@amount}*{@Price})/100
    else
    {@amount}
    {@Total_Market}:{@market}+ {@Price}
    Running formula to get Total_market: Details section
    whileprintingrecords;
    numbervar sumpct4 := sumpct4 + {@Total_Market};
    numbervar grtotal4 := grtotal4 + {@Total_Market};
    Group Footer 3B: Deal No
    Group Footer 3A: Deal No
    Group Footer 2:Type
    In this group I am placing a running total formula:
    whileprintingrecords;
    numbervar sumpct4;
    Group Footer 1: CCY
    Report Footer:
    @grand_Total
    whileprintingrecords;
    numbervar grtotal4;
    Now, i want this @grand_total formula result to be shown in Group Header 1: CCY.
    I tried to insert a subreport at the beginning which it is a copy of the main report, but I did not get the coorec t result because I am getting the {@amount} from a subreport and in crystal I can't insert a subreport in an existing subreport.

  • Get the Stored Function Results

    If there is DML in my Stored Function ,how to Using View Objects to Select Stored Function Results?
    I want to get the Stored Function Results in my jsp.
    please give me the example jsp.Thanks!

    There's an article on my "Dive into BC4J" weblog that describes this.
    http://radio.weblogs.com/0118231/stories/2003/02/06/usingViewObjectsToSelectStoredFunctionResults.html

  • What to do with t0 in Get Waveform Subset.vi

    I am new to LabVIEW.  I was trying to look at the Get Waveform Subset.vi, and it doesn't explain what to put in for t0.  At the moment, when I try and put my waveform through the subset VI and display that on a separate waveform, I get nothing displayed.  My settings are in the attached screenshot.  I am not getting any error message, therefore am struggling to understand what I am doing wrong.
    Attachments:
    Screen Shot 2015-02-07 at 7 Feb 2015 16.03.03.png ‏311 KB

    I have now attached a copy of my VI.  What I've been asked to do is produce a sine wave with the amplitude and frequency adjustable via controls on the front panel, which I have done.  However I also need to display a section afterwards.  I know I can wire up a control to the phase of the simulate signal VI, so do I have to just use the simulate signal VI twice, once with the full sine wave and once with the phase shift, or is there a less convoluted way of doing this?
    Attachments:
    Screen Shot 2015-02-10 at 10 Feb 2015 18.58.51 (2).png ‏688 KB
    Screen Shot 2015-02-10 at 10 Feb 2015 18.58.51 (2).png ‏688 KB
    Screen Shot 2015-02-10 at 10 Feb 2015 18.58.51 (2).png ‏688 KB

  • Am I going to get a better end result in ProRes NTSC, than in DV NTSC??

    I'm just starting to edit a 90 minute show that has been set up in DV NTSC anamorphic. If I switch over to working in ProRes NTSC anamorphic, will I get a better end result?
    All ears,
    Ben

    Thank you for doing that Studio X, very helpful. I've been wanting to work with ProRes for the last year or so ... but haven't had the chance, mostly either HDV or DVCPRO HD (or a variation thereof).
    Maybe this is the job to try it on.
    I'll post a comment when I've made some tests -- to see if there is an obviously visible difference in the end result.
    All the best,
    Ben

  • Bex Query getting Freezed while formatting results

    Hi Friends,
    I am running a BEx Query with one year data selection but it's getting freezes while formatting results. But when i deselect the 'Format after refresh' option  in the query properties..then query is running fine.
    Could you please let me know if there is any reason for this?
    Regards,
    Mahesh

    Hi,
    Just generate your query once with program RSR_GEN_DIRECT_ALL_QUERIES.
    By selecting your multiprovider .
    Thanks,
    Ranjan

  • Get waveform subset vi lagging

    Hello all,
    I'm running into an issue with a Get Waveform Subset.vi taking an awfully long time to run (~15s). I'm working with a large-ish data set (5431296 data points). I double checked with the Performance and Memory tool and it's defiantly something with this VI.
    The program is suppose to grab a new subset from the waveform and look for a trigger, record where the event happens, then move onto the next subset and repeat. 
    Am I doing something wrong with the VI to make it lag so much? Or better yet, is there a better way to do what I'm trying to accomplish? 
    Attachments:
    Problem with GetWaveformSubset.JPG ‏66 KB

    Hi Lynn,
    What values are you using for Start samples and Duration?
    Start: 333131 initially then it increments depending on where the triggered edge is 
    Duration: 55 samples
    Do you get any errors?
    None that I could see. The Get Waveform Subset vi rounded my duration and start sample values which I was fine with.
    How many iterations does it run. 
    The current code runs ~800 - 900 iteration. 
    So since it last posted, I removed the Get Waveform Subset vi and replaced it with a ArraySubset thinking it would speed things up. Turns out the Get Waveform Subset vi is fairly optimized already...go figure.I also decimated my waveform using the Resample Waveform vi to reduce the number of samples in each subset. By playing with my re sampling interval, I was able to reduce the run time to ~ 3 seconds.
    So here's what I'm actually trying to do and for full disclosure, yes, it is for a school assignment.
    I have a signal from a NOAA satellite that I'm trying to convert into a image. The data is sent using APT format and is not real time, rather just an audio file. I have managed to demodulate the signal and removed the carrier wave and filtered the signal appropriately. What I'm having issues with is detecting synchronization pulses in my signal. Right now, my sync pulse detection scheme involves running a FIR bandpass filter at the sync pulse frequency and then using trigger detection to find where my sync pulses start.
    Am I going about this the wrong way? Is there a more efficient method I should be looking at. 
    Honson

  • Get waveform subset x-scale

    When you get a subset from a waveform, the subset starts the x-scale at 0. Is it possible to have the same scale as which you have acquired the subset? ie if i start a 0.4s and my duration is 0.4s, i would like my subset graph to start at 0.4s instead of 0.

    Have a look at the attached vi. May be there is something even more simple.
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Subset and t0.zip ‏12 KB

  • "Get Waveform Subset": version incompatibility

    Hello everybody!
    I was studing an already developped software and there was something relative to waveform uses that I didn't get it (concretly it was that I didn't know very well what I have to put in the Duration input when I was using the Get Waveform Subset function in the Relative Time mode. Should the duration be "T0 + sth" or just "sth"?)
    Then, to understand it, I tried to simulated it. I was working at the same time with 2 computers with 2 different versions of Labview (7.1 and 8.6). The funny thing is that I created exactly the same VI for the oldest version and the new one, however it only works for the oldest one. When I try to run the new version I get that mistake message:
    "Error -1801 occurred at Start value too large in Get Waveform Subset.VI.
    Possible reason(s):
    LabVIEW:  (Hex 0xFFFFF8F7) Duration input is not an integer multiple of dt. Value was coerced to nearest integer multiple of dt."
    What's wrong with my new Labview version subvi?
    Thank you!!
    Attachments:
    8.6 version.JPG ‏18 KB
    7.1 version.JPG ‏41 KB

    GovBob,  
     Thanks a lot for your solution. Writing zero in the start input it does work.  However there are 2 things I don't understand: 
    1-.Why does it work in the oldest version using the  elapsed second function?Is the output of this function a longer number now? I think it should also work for the newest versions.
     2-.If we can't write a time stamp, what do we have to do to skip the samples of a period of time? If we use like a starting time zero, what is the difference now between the relative time mode and the sample one? 
     I have wondered that, and I have been doing some tests and now I am more confused that before I was. :s  
    First of all, I was thinking: If we don't want to skip the first samples is logical that it does work for zero. I imagined that if for instance our wave starts in the second number 1000, so if we write a number below 1000, we are going to get always samples from the first positions (we could also get samples from other position but the first one would be always in the output wave).However when I wrote a signal, using as a t0 the elapsed second function and dt:1. Then I used "get waveform subset" in the relative time mode, and I set start:1 and duration:1, I got the second sample instead of the first one. (I was expecting the first one for the reason I have already explained) 
    Also, thinking about the behaviour of the function in the relative time mode I have done some test, in order to get a pattern, but I haven't successed. I will attached a file with the ideas got from the tests.
    Attachments:
    subwaveform.txt ‏3 KB

  • How do I get a subset of a result set

    I am getting a result set from a remote data source. After the resultset is returned how can I do a select on the result to return a subset of records?
    My code:
    package com.drawingpdmw1;
    import java.sql.*;
    import com.ibm.as400.access.*;
    * @author sde
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    public class getLastDashNumberConnection {
         public String errorString;
         public String literalerrorString;
         public String maxRecSeq;
         public getLastDashNumberConnection(String arg0) {
                      AS400JDBCDataSource datasource = new AS400JDBCDataSource("gvas400");
                 datasource.setTranslateBinary(true);
                 datasource.setUser("drawchg");
                 datasource.setPassword("webabc1");
                 try{
                      Connection connection = datasource.getConnection();
                     Statement stmt = connection.createStatement();
                     String sql = "select distinct dmdrawno from webprddt6.drawmext3 Where dmdrawno LIKE '%" + arg0.substring(0,6) + "%'";
                     ResultSet rs = stmt.executeQuery(sql);
                     while(rs.next()){
                          System.out.println(rs.getString("dmdrawno").trim());
                     errorString = "";
                     literalerrorString = "NoError";
                 catch(SQLException sqle){
                      System.out.println("Error");
                      System.out.println(sqle);
                      errorString = "Warning!!! A New Dash Number could not be created!";
                       literalerrorString = "Error";
    }

    First, thanks for the info on closing my objects.
    Now as far as the data here is my situation. The purpose of this class is to return the next dash number that can be used for a series of partnumbers. In most cases the series is constructed with only one type of dash numbers. Example: -401, -403, -405 dashes that start with a 4 are assemblies. This is easy to figure out the nex dash(-407).
    However, some of our partnumber series have dashes like -001, -003, -005 which are detail level part numbers along with the -401 etc.
    Now a user needs to create a new dash number. First, is this a detail dash or an assy dash. My idea is to get all the possibilites for a series, check for dash types, then return the next dash for each type.

Maybe you are looking for

  • "BCD file is missing some information Error code: 0xc0000034"

    This laptop is a Dell Inspiron 15 (3521), it's operating system is Windows 8, it has no warranty, nor an installation media. I don't know how to repair it, or what caused this problem. I don't know if Dell would be able to help as it has no warranty.

  • Third Party Payment in EBS HRMS 11.5.10.2

    Dears, How to set up third party payments in HRMS ? for example I have a payroll element BANK_LOAN_DEDUCTION of type Involuntary Deduction, I want the pay value of this element should be paid to the particular bank Please advise how the issue can be

  • I can't get the convert to word command to work?

    How do I get the Convert to Word function to work?  

  • Silverlight 5

    Mac OS X 10.8.5  Safari 6.2.3 Silverlight 5 downloads, the .pkg won't open. Message said that developer cannot be confirmed. A search for Silverlight on the computer shows Silverlight 1 and 2 and 3 Do I need to delete all those previous versions? And

  • Span port recording

    Hi All, A real idiot question but we have to use span port recording as we are using citrix (unless anyone knows different) but I just can't get my head around the span part at the UCCX end. Span on all the access switches is fine but the server is o