Sorting without quering???

Hello,
is there any way that we can sort a block by a column without executing the query again...if yes then please tell me how can i achieve this,,
I have a form based on view made on columns form three different tables having 5000 records and i have a button that sorts a particular column in ascending/descending order when pressed..
I am currently uisng the execute_query et the end of my sorting code. and is taking 8 seconds to sort the block when the button is pressed.
the block show 24 records at a time..
I just want to know if there is any way that we can sort the data without quering again as the data is already in the form..and it will not take 8 seconds..
thanks in advance
regards,

I do not query 5000 records on first execute query, only 24 records are
retieved when the form runs and for 24 records it is still taking 8 seconds.Then something has gone wrong. Even if the server is doing a full-table-scan to order the 5000 records, then passing the first 24 to your form, that should only take about a second.
Have you done something by mistake, like setting the block's Query All Records property to Yes, or maybe issued a Last_Record; command after the query?
And how long does a similar query take in SQL Plus? You can test it this way:
Declare
  Cursor C is
    -- this select should have the same where and order by as in your form:
    Select  col_1, colL_2, etc...
     from whatever_tables
     where ...
     order by col_A, col_B, etc... ;
  R C%rowtype;
Begin
  Open C;
  for i in 1..24 loop
    Fetch C into R;
  end loop;
  Close C;
End;
/

Similar Messages

  • I sorted my worksheet and it saved the sort without asking if I wanted to save it!  How did this happen?

    I am on a mac mini OS X Yosemite using Numbers 3.5.2.
    I opened an existing spreadsheet, sorted one of the columns, then closed it out so I could open it and it would no longer be sorted (the sort screwed up all my headings), and the sort was saved!  Why did it save my sort without asking if I wanted to save the changes?

    Hi Julia,
    System Preferences > General > Ask to keep changes when closing documents
    This may recover the previous version:
    Regards,
    Ian.

  • Open items sorting without +/- sign

    Hi SAP GURU's,
    i would like to display the open items without +/- sign when i will try to sort. it is possible in edit options in while clearing. but when i will try to display the open items i can not get that option.
    Please send the solution as early as possible.
    your assistance will be highly appreciated.
    Regards,
    suresh konisetty.

    Suresh,
    Not possible w/o +/- sorting.

  • Sorting without reloading the page

    Hi,
    I'd like to know how processing several sorting operations without reloading and ask the database each time the sorting of the elements is made.
    For that I guess a copy of the result tree obtained by the sql query, written in the xsql page, must be present in memory and always available for the several sorting processes (but is this a temporary xml document which is created? How handle and use this "copy"?). So, one and only one access to the database would be required.
    But I don't know how such a thing works?
    Thanks a lot to help me on this point.
    Bye

    You can easily do that by implementing the apex error handling function.
    See this working example http://apex.oracle.com/pls/apex/f?p=46417:10
    Login as test/test
    By default APEX shows an javascript alert message, I actually overwrote the native alert to show a message div using jquery
    function alert(message) {
    //    console.info(message);
    var msgBox = $('#msg-box');
      if (msgBox.length === 0) {
          msgBox = $('<div />', { 'id': 'msg-box'}).hide().prependTo('body');
      msgBox.html(message+' <a href="javascript:void(0);" onclick="$(\'#msg-box\').hide();">X</a>').fadeIn(500);
    }See {message:id=10735215}

  • Sorting without headers

    I am creating a book list and want to sort my columns without the headers. The header is sorted within my document.
    Help - thanks

    Look in that same forums "Questions and Answers" area. I already posted 2 & 3, Just posted Four last night. Starting work on 5 now.
    Numbers templates.com Forums
    Leave me feedback on what you think. I tried to make them short (5-10 pages each). So its an easy comfortable read. The whole book is about 30 pages right now.
    Using Pages as the word processor. Cmd-Shift-4 for screen shots. Nothing special beyond that.
    Hope you like the rest too... anyone else is invited to look at it too. Its free (my wife thinks we should publish when its done, maybe as an ebook) Your my 'Peer reviewers' and 'editors' I guess.
    Thanks,
    Jason

  • Sort without BY addition & Table Key

    Experts,
    From SAP Help,
    If no explicit sort key is entered using the BY addition, the internal table itab is sorted according to the table key.
    I have code as below,
    data: lt_vkonto type table of VKONT_KK. "Cont Acc No
    "Fetch Cont Acc no against Contract
    select vkonto from ever into table lt_vkonto where vertrag = wa_data-vertrag.
    if sy-subrc eq 0.
    sort lt_vkonto.
    endif.
    As seen above, I have sort statement without BY addition for internal table lt_vkonto which does not have a UNIQUE or NON UNIQUE key.
    Will adding BY addition --> SORT lt_vkonto by vkonto imrpove the performance of sort statement.
    Please share your valuable inputs.
    BR,
    Aspire

    Hi
    I don't know if you'll imporve the performace in your case, you should do some measurement, the problem should be the table key for a standard internal table (like yours) is the set of all CHAR fields.
    In you situation you've only one fields, but probably if the table has several char fields the performance can be improved
    Anyway I suppose it's always better to explicit an option else the system will have to deduct it by itself, so the system will do an additional step: in your case without BY, the system has to deduct the key to be used for the sorting.
    Max

  • How can you sort without adding all the music to iTunes?

    I'm an older person and I don't get it. At first I just had a shuffle and I downloaded specific songs into iTunes that I liked. Then I upgraded. I loaded a whole bunch of cd's into various libraries at various times on an external hard drive. Now, I have a ton of music and would love an easy way to organize it! There are lots of duplicates and lots of songs I just don't like. The trouble is, I haven't figured out how to just see a list of all the songs and sort and delete from the list. I have to open a library and then I get a bunch of file folders of an album or two. Then I have to open the album to see the songs. If I forget what the song sounds like and I click on it to play it, the album goes automatically into iTunes. I don't have enough room on my pc for all that music to go right into iTunes. Do you get my question?? Can you help me?

    When you play a song with iTunes, it automatically gets added to the library, as you noticed.
    If you just want to play the song so you can decide whether to keep or delete it, use another player. You may already have Windows Media Player on your machine. If not you can download Winamp.
    When you are done sorting, add the ones you want into your iTunes library

  • JTree - sorting without collapsing

    i have a JTree which represents data stored in my data layer. if this data changes, i do not only have to update the view part in the tree but also resort it to certain criteria. as far as well, this works fair enough, my problem is, that with every resorting, i remove/add children in the JTree which leads to structure changes. notifying them to the JTree results in the collapsing of all the branches under the event source. how can i prevent that? i'd like to just resort the nodes on one level and leave the collapse/expand of the nodes as it was.
    tnx for the help!

    Thanks for your advice, i tried that but it doesn't seem to work with my code, the effect stays the same. what do i have to change?
    Note:
    snippetComparator cmp = new MyComparator();
    SortedSet sorted = new TreeSet(cmp);
    sorted.addAll(this.children);
    int i = 0;
    for (Iterator it = sorted.iterator(); it.hasNext(); i++) {
    DefaultMutableTreeNode element = (DefaultMutableTreeNode)it.next();
    this.treeModel.removeNodeFromParent(element);
    this.treeModel.insertNodeInto(element, this, i);
    <<snippet
    this is all i do, no manual creation of any TreeEvents.

  • Dynamic Sorting without using ALV

    Need the internal table to be sorted by the fields entered by the user.(sort selections)
    Note: all the control breaks statements should work with respect to the fields selected.
    Early response in this regard is very much appreciated.
    Thanks,
    Maheshwari.V

    Hi Maheswari,
       First populate the fields you want to sort
       in a order like below based on conditions.
    DATA: BEGIN OF dT_SORT OCCURS 0,
            FIELD1(20) TYPE C,
            FIELD2(20) TYPE C,
            FIELD3(20) TYPE C,
            FIELD4(20) TYPE C,
            field5(20) type c,
           END  OF dT_SORT.
    Poupate the dt_sort with the user specified fields.
    dt_sort-field1 = field2.
    APPEND dt_sort.
    dt_sort-field2 = field1.
    APPEND dt_sort.
    dt_sort-field3 = field3.
    APPEND dt_sort.
    dt_sort-field4 = field4.
    APPEND dt_sort.
    dt_sort-field5 = field5.
    APPEND dt_sort.
    SORT dt_members   BY   (dt_sort-field1)
                           (dt_sort-field2)
                           (dt_sort-field3)
                           (dt_sort-field4)
                           (dt_sort-field5).
    Hope this will help you.
    Thanks&Regards,
    Siri.
    Message was edited by: Srilatha T

  • Oracle 10G gives in sorted order without order by ,in 11g it is not.

    we are facing a strange problem.
    we have M Views on which we perform select operation ,we put joins of M Views and get the results by select operation , the results was in sorted order (asc) and we were not using any order by clause in the select query , this was in oracle 10G.
    The compelte schema where these M views are and also the underneath tables are now migrated to oracle 11g using import/export option.
    Now the queries which was giving the result set in sorted order (asc), are not given the result set in sorted order anymore. it is in different order but I think at always return the same order not asc or desc but an specific random order .
    we can not change the query as of now as there are 1000+ and each query would require a order by statement .
    Do we have any parameters which can be change , so that we can force oracle to use a different plan so that it gives result in order ?
    the select queries are very simple ones not complicated no extra function or group by is used in most of the queries.
    Please suggest possible solutions . Thanks much.

    Su**** wrote:
    Please guide me how to go to this doc link ,i am newbi, and do not how to go to this link.
    MOS Doc 345048.1 ('Group By' Does Not Guarantee a Sort Without Order By Clause In 10g and Above)
    Go to http://support.oracle.com, log in to My Oracle Support, and search for 345048.1 If you don't have a My Oracle Support account, you'll need to contact whoever manages your company's Oracle support and ask them to create an account for you.
    Basically, no version of Oracle has ever guaranteed the order of results if you don't specify an ORDER BY clause. In 10g, the only algorithm that was available to implement a GROUP BY happened to sort the results as a side effect. 11g introduced a new algorithm for grouping results that is more efficient and does not have the side effect of ordering the results. Most likely, your query plans have changed to use the more efficient grouping algorithm.
    If you want the results to be sorted, you should add an appropriate ORDER BY clause. If you go through the MOS document, there will also be suggestions for ways that you can disable the new grouping algorithm though I would not recommend that.
    Justin

  • How to sort random number without the used of order by

    Hi ,
    how should 5 random number be sorted without the use of order by in PLSQL
    eg.
    id amount
    1 2
    2 9
    3 3
    4 5
    5 7
    Edited by: sake1 on 1-dec-2010 8:16

    I used Altavista and found one example, how does it look?
    DECLARE
      /* there is no built array in oracle, you must declare
      your own */
      TYPE Numarray IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
      /* the array of numbers - using assoc array because I can start
      with zero like traditional arrays */
      Nums Numarray;
      n NUMBER := 0;
      Temp NUMBER;
    BEGIN
      /* load up the array, put 20 random values in the array,
      in array indicies 0 to 19 */
      FOR i IN 0 .. 19
       LOOP
        Nums(i) :=  Round(Dbms_Random.Value(1, 1000));
      END LOOP;
      /* get the array size */
      n :=  Nums.Count();
      /* display the unsorted values - loop through the whole array and
      print out the values */
      Dbms_Output.Put_Line('unsorted:');
      FOR i IN Nums.First .. Nums.Last LOOP
        Dbms_Output.Put_Line(Nums(i));
      END LOOP;
      /* bubble sort - using two loops, compare each value with the one
      after it
      if the one after the current one is smaller , then
      switch their locations in the array, this is just like standard
      bubble sorts
      in other languages. The only real diff is the syntax.
      FOR i IN 0 .. n - 1 LOOP
        FOR j IN 0 .. n - (i + 1) - 1 LOOP
          IF (Nums(j) > Nums(j + 1)) THEN
            Temp := Nums(j);
            Nums(j) :=  Nums(j + 1);
            Nums(j + 1) :=  Temp;
          END IF;
        END LOOP;
      END LOOP;
      /* display the values sorted */
      Dbms_Output.Put_Line('sorted');
      FOR i IN Nums.First .. Nums.Last LOOP
        Dbms_Output.Put_Line(Chr(9) || Nums(i));
      END LOOP;
    END;
    unsorted:
    155
    909
    795
    977
    942
    214
    105
    269
    283
    820
    108
    594
    784
    921
    856
    736
    802
    457
    951
    411
    sorted
         105
         108
         155
         214
         269
         283
         411
         457
         594
         736
         784
         795
         802
         820
         856
         909
         921
         942
         951
         977
    */In the code the first comment is wrong actually i think, that one:
    "there is no built array in oracle, you must declare your own"
    I remember there were some system collection-types, if i'm not mixing with something, i remember there was some kind of such but they were un-documented ones, so we can juridically say that the comment in the code was still correct.

  • Report needed - Open materials on PO, sorted by material and not PO number

    Hello,
    I've been trying to obtain a report that can give me a list of materials that are open for all PO numbers.  Instead of this being sorted by PO number, I want it sorted by material number.
    I've gone through all the ME2 transactions (i.e. ME2L, ME2M, ME2N, etc.) and all iterations of the scope of list with the selelction parameter WE101, but every time it comes up sorting by Purchase Order and then listing the open materials on the specific PO.
    I've gone through transaction ME80FN, which gives all the proper information I need, but there's no indicator in there looking for materials with only open quantities...it only gives both open and closed.
    Does anyone have any recommendations for a standard SAP report that can be accessed?
    Edited by: Andy Slania on Sep 27, 2010 9:15 PM

    Andy,
    I don't think there is one in the older R/3 systems.  I don't really know, because I quit looking after I discovered SAP Query (SQ01)..
    If a standard SAP report doesn't meet business requirements, one can have an ABAPer create a custom (Z) report.  However, another path is to use SQ02/SQ01 to create reports that may meet the needs, without commissioning a new ABAP report.
    In 4.6C it is possible to create Queries that have all the data found in the ME2* reports, but additionally can have ALV output.  Of course, in your case, since you can define 'sorts' in queries, ALV becomes a moot point.
    A Query expert can create enhanced PO reports that will satisfy most any requirement.  If the query infoset uses a SAP database, such as MEPOLDB, then it is not even necessary to create joins of tables - SAP has already done the heavy lifting.
    Best Regards,
    DB49

  • Performance of context index with sorting

    Dear All,
    I've got a problem and don't know how to solve this.
    there has a table which have a XMLTYPE field to store the unstructred xml, and created with context index.
    When I try to select a record from it by using contains (res, '[searchingfield]')>0, the response time is quick, but when I try to order by another field which in the same table, the response time is drop down slightly. (ex. select id, path, res, update_date from testingtbl where contains(res, 'shopper')>0 order by update_date desc.
    Actually there is a context index build for field 'res', any other index build for field 'update_date', when sql without 'order by update_date', the context index will use, but the update_date index will not be used even have ordering criteria.
    Is there any expect can tell how to solve this? how to keep the performance even doing the sorting process?
    Thanks and Regards
    Raymond

    Thanks for your quick reply.
    The mentions information provide after back to office, actually I just want to know if there is any method(s) which can use the context index (with contains keyword) and sorting without slow down the performance.
    Thanks and Regards
    Raymond

  • Custom Sort (by date) in a DataGrid component

    So I've got a data grid component hooked up to a data provider like so:
    var weekData:XML=// some xml loaded in earlier....
    var weekGrid:DataGrid=new DataGrid();
    var dataProvider:DataProvider=new DataProvider();
    for each(var entry:XML in weekData){
         dp.addItem({event:entry.title,date:FormatDate.format(new Date(entry.@startDate),5),data:entry.@startDate});
    The title column is just what you might think. The date colum is actually a format like May 2012 or Feb 2013. And the data "column" isn't actually shown in the dataGrid it is the "key" for sorting by date. It contains the getTime() value of the date like 1328515200000. So that will make date sorting just a case of Array.NUMERIC with the appropriate Array.DESCENDING when needed.
    I've found that if I do this:
    weekGrid.dataProvider.sortOn("data",Array.NUMERIC)
    weekGrid.invalidate();
    it works and the grid is sorted -- IF I have some other button to click to cause that code to run.
    I want to tie it together with the click event on the grid header. Thusly:
    weekGrid.addEventListener(DataGridEvent.HEADER_RELEASE,sortDataGrid);
    And I've getting the event and all, but evidently that is fireing off the built-in sorting which happens after mine. And it doesn't do what I want.
    Any idea how to stop that and allow my perferred sorting to take place?

    if you don't want the user to sort your datagrid, use:
    weekGrid.sortableColumns = false;
    and execute your sort without clicking anything.  or use:
    weekGrid.addEventListener(DataGridEvent.HEADER_RELEASE,sortDataGrid);
    function sortDataGrid(e:DataGridEvent):void{
        setTimeout(sortF,100);
    function sortF():void{
        weekGrid.dataProvider.sortOn("data",Array.NUMERIC)

  • Sorting FTREE nodes

    is there a way to populate a FTREE object such that the nodes are sorted without loss of hierarchy? I read in a note that the "ORDER BY" clause cannot be used. On the other hand, the items are often "shuffled", and it may be hard for the users to retrieve what they are searching.
    Is there some alternative way to obtain it (for example, by splitting the building process level-by-level instead of using a single query)?

    As Andreas suggested, you can use ORDER SIBLINGS BY in your tree query to order the level 2 and up nodes with a specific order.
    Oracle Forms 10g and 9i does support this SQL syntax.
    sample:
    CONNECT BY PRIOR M.NODE_ID = M.NODE_PARENT
      START WITH M.NODE_PARENT IS NULL
    ORDER SIBLINGS BY M.NODE_ORDERTony

Maybe you are looking for