Select ordered by ROWID

Hi
I read records from table and to do update in 3 tables , to commit each 5000 records, close and open Cursor again and to continue where stopped
Is possible it ?
I tried to save rowid source table inside source table, but rowid is not ordered, I tried put ORDER BY mytable.rowid, was slow , very much slow
Please, are there some way ?

Assuming this is related to the other two threads you have going on in the forum on the same topic, you're probably better served posting followups there rather than starting a new thread. Otherwise, a lot of folks will waste time and effort repeating advice that others have given in your other two threads and will miss the context you're providing in the other threads.
Justin

Similar Messages

  • Order by rowid clause added without my knowledge in Reports gen package

    I have a devlp system and a production system.(3.0.9.8.0)
    I built a report with lots of decode, sum, roll up, group by
    clauses to create a cross table summing matrix report. It ran
    correctly in the Devlp Portal system.
    I exported it and imported this into the Production system.
    Few weeks later I realized that the same report was not working
    on the Production system. After some debugging, I noticed in
    the generated PLSQL package body there is a if-else block that
    basically adds "order by rowid" when the orderby clause is null.
    However, the package body on the devlp system does not do
    that. The only IF block it has is to determine if it needs to
    apply the order by clause or not, no "else"
    This additional generated "order by rowid" is breaking the
    report because it will not work with my group by query.
    My question is - How did that get added into the plsql
    package, when I did not check anything to make that happen ??
    -Ananth

    I am getting similar execution plan on huge data. I cannot post the query here but here is the execution plan:
    Execution Plan [with order by clause]
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=22644 Card=4303 Byte
    s=3795246)
    1 0 COUNT (STOPKEY)
    2 1 NESTED LOOPS (OUTER) (Cost=22644 Card=4303 Bytes=3795246 )
    3 2 VIEW (Cost=9735 Card=4303 Bytes=2263378)
    4 3 SORT (ORDER BY) (Cost=9735 Card=4303 Bytes=529269)
    5 4 FILTER
    6 5 TABLE ACCESS (FULL) OF 'A' (Cost=9542 Car
    d=4303 Bytes=529269)
    7 5 TABLE ACCESS (BY INDEX ROWID) OF 'B' (Cost
    =3 Card=1 Bytes=11)
    8 7 INDEX (UNIQUE SCAN) OF 'B_PK' (UNIQUE) (
    Cost=2 Card=1)
    9 5 TABLE ACCESS (BY INDEX ROWID) OF 'A' (Cos
    t=5 Card=1 Bytes=14)
    10 9 INDEX (RANGE SCAN) OF 'A_X_KEY' (
    UNIQUE) (Cost=3 Card=1)
    11 5 TABLE ACCESS (BY INDEX ROWID) OF 'B' (Cost
    =3 Card=1 Bytes=11)
    12 11 INDEX (UNIQUE SCAN) OF 'B_PK' (UNIQUE) (
    Cost=2 Card=1)
    13 2 TABLE ACCESS (BY INDEX ROWID) OF 'B' (Cost=3 Car
    d=899140 Bytes=320093840)
    14 13 INDEX (RANGE SCAN) OF 'B_XXX_X' (NON-UNIQUE) (
    Cost=2 Card=899140)
    query 2[ without sort]
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=23349 Card=4303 Byte
    s=26592540)
    1 0 COUNT (STOPKEY)
    2 1 VIEW (Cost=23349 Card=4303 Bytes=26592540)
    3 2 SORT (ORDER BY STOPKEY) (Cost=23349 Card=4303 Bytes=20
    61137)
    4 3 FILTER
    5 4 NESTED LOOPS (OUTER) (Cost=22451 Card=4303 Bytes=2 061137)
    6 5 TABLE ACCESS (FULL) OF 'A' (Cost=9542 Car
    d=4303 Bytes=529269)
    7 5 TABLE ACCESS (BY INDEX ROWID) OF 'B' (Cost
    =3 Card=899140 Bytes=320093840)
    8 7 INDEX (RANGE SCAN) OF 'B_XXX_X' (NON-UNI
    QUE) (Cost=2 Card=899140)
    9 4 TABLE ACCESS (BY INDEX ROWID) OF 'B' (Cost=3
    Card=1 Bytes=11)
    10 9 INDEX (UNIQUE SCAN) OF 'B_PK' (UNIQUE) (Co
    st=2 Card=1)
    11 4 TABLE ACCESS (BY INDEX ROWID) OF 'A' (Cost=
    5 Card=1 Bytes=14)
    12 11 INDEX (RANGE SCAN) OF 'A_X_KEY' (UN
    IQUE) (Cost=3 Card=1)
    13 4 TABLE ACCESS (BY INDEX ROWID) OF 'B' (Cost=3
    Card=1 Bytes=11)
    14 13 INDEX (UNIQUE SCAN) OF 'B_PK' (UNIQUE) (Co
    st=2 Card=1)

  • Is there a way to get the selection order for selectedProperties?

    app.project.activeItem.selectedLayers seems to be ordered by the selection order, but app.project.activeItem.selectedProperties (at least in Shape Layers) seems to be ordered by the stacking order. Is there a way to get the selection order for selectedProperties?
    Thank you!

    Hi,
    i had tried to investigate this a while back and it's really hard to figure out.
    The array seems to be reorganized using various rules:
         At layer level : preserve the user layer selection order,
         Children of indexed groups : propertyIndex ordering,
         Children of named groups : some internal ordering.
    The following is may be more detail than necessary, and given that it is based on observation, not official docs, it is not so reliable, but well, it might still be of interest !!
    Say you have 2 selected properties A, and B, and call [COMMON PARENT] their "greatest common ancestor", that is:
            A = [COMMON PARENT].property(a1).... property(aA);
            B = [COMMON PARENT].property(b1).... ...property(bB);
    with a1 != b1. Then:
    if [COMMON PARENT] = A (ie if A is an ancestor of B), then A comes first.
            For instance: if you select comp.layer(1).mask(1).maskPath, there are 2 selected properties, the mask group and its maskPath: the first is the group and the second the path (the parent comes first).
    if [COMMON PARENT] is the containing composition, ie A is a property inside comp.layer(a1), and B a property inside comp.layer(b1), then A and B are ordered according to the layers selection order.
            This can have some strange side effects. For instance:
                deselect everything
                select comp.layer(2) (and nothing else)
                select comp.layer(1).transform.position
                select comp.layer(2).transform.position
                ===> comp.selectedProperties = [comp.layer(2).transform.position, comp.layer(1).transform.position] even though the first entry was effectively selected after the second...
    if [COMMON PARENT] is an indexed group, A and B are ordered by propertyIndex
            For instance:
                if you select comp.layer(1).mask(2), then comp.layer(1).mask(1), mask(1) appears before mask(2)
    if [COMMON PARENT] is a named group, ... no clue (internal ordering).
            For instance, at propertyDepth 1, it seems that Time Remapping < Effects < Masks < Material Options < Transform, etc, independantly of the selection order, and this is also not the propertyIndex ordering.
            At higher depth, in CS5 the ordering seems to be the propertyIndex ordering, but it is no longer true in CC.
            For instance, selected Position (index 2), Scale (index 6) and Opacity (index 11) in various order on the same layer.
            in CS5 : selectedProperties = [Position, Scale, Opacity];    // propertyIndex ordering, always
            in CC : selectedProperties = [Scale, Position, Opacity];    // always the same ordering, but not the propertyIndex one
    So the ordering is a lexicographic ordering (Compare the ancestor of depth 0. If no difference, compare the ancestor of depth 1. If no diff, compare the ancestor at depth 2. And so forth).
    But at each step, the comparaison depends on the type of the ancestor, and when the type is named group, the ordering is internal so we can't know.
    Practically the most important thing is that selected properties seem to be reorganized by "containing layer" (the layer selection is preserved),
    and then in each layer selected properties are "grouped by same parent": you can't have a mask related property, then an effect related property, then another mask related property:
    all masks related properties appears together, all effect related properties appear together, etc.
    If several effects are selected, effect(1) and all its properties appear first (if selected), then effect(2) and all its properties would appear second etc
    and so forth
    Xavier.

  • How to select the max rowid from a subquery with group by

    Hi Gurus,
    Kindly help how to fix the following query because I'm getting Oracle error:ORA-01446.
    select * from edy_raw_data a
    where rowid in ( select max(rowid) from(
    select email,max(date_updated) from edy_raw_data b
    where b.email=a.email
    group by email ))
    The query select the max rowid from a sub query with group by.
    Thanks in Advance.
    Benjie

    Why do you need to compare with rowid?
    Wouldn't this suffice?
    select * from edy_raw_data a
    where (email,date_updated) = (select email, max(date_updated) from edy_raw_data b
                        where b.email=a.email
                        group by b.email ))* Note: untested

  • IDVD 09:  Scenes page - Chapter select order in wrong order

    I have an iDVD (iLife09) project that contains 35 chapters and have previewed it in DVD Player.
    When using the controller's right advance button, the chapters are not selected in their proper order. Each scene page has a different chapter select order, with none of them being logical or correct. I had edited the video and added the chapters in Final Cut Express and then separately in iMovie. Both have the same results.
    It seems that this has been a long-lived problem, as I recall having the same results with a few earlier versions of iDVD. Unfortunately, if you have a slick video, the Scenes/Chapter selection options makes for a poor presentation.
    Any fixes, suggestions, or reasons why this is an ongoing problem would be greatly appreciated.

    Did you follow these steps?
    http://support.apple.com/kb/TS1611
    http://support.apple.com/downloads/iLifeSupport_9_03
    http://www.mydvdedit.com/index.php?lang=english
    http://www.dvinfo.net/conf/non-linear-editing-mac/127485-quality-fce-imovie-idvd -fc.html
    http://archive.bagelturf.com/canons3/s3fce/index.php
    http://www.simplydv.co.uk/simplyBB/viewtopic.php?f=4&t=20934
    The above are additional tools / links you may find useful but if not just come on back.
    Disclaimer: Apple does not necessarily endorse any suggestions, solutions, or third-party software / products that may be mentioned in this topic. Apple encourages you to first seek a solution at Apple Support. The following links are provided as is, with no guarantee of the effectiveness or reliability of the information. Apple does not guarantee that these links will be maintained or functional at any given time. Use the information above at your own discretion.
    Message was edited by: SDMacuser

  • Object selection order.

    I wonder if there's a way to set the selection index as to the real selection order and not the creation order.
    e.g.
    if i create 3 textframes on a page:
    named these as txtFrame1, txtFrame2 and txtFrame3.
    I first select txtFrame3 followed by txtFrame1 and last txtFrame2 and assign them as TEXT tag.
    in InDesign CS2, result will be:
    The sequence in the XML structure will be exactly which I select and tag first.
    which is: content of txtFrame3, then content of txtFrame1 and last content of txtFrame2.
    However in CS3/CS4
    The sequence in the XML structure will be based on the creation of the txtFrames on the page.
    which is: content of txtFrame1, then content of txtFrame2, content of txtFrame3!!!
    Is there a way to have it as what the CS2 way?
    Thanks a million!!!

    I guess with their productivity highly affected,
    adobe may loss more than hundreds of upgrade sales from these group of people.
    to be honest ... I don't think they care ...
    for me - removing this option is inexplicable - I can understand why some options can't be added at beginning - but I can't understand why 100% usefull information is removed in new version of program ... if somebody need to get order of creation - he can collect IDs of all selected objects and sort ... 
    robin
    www.adobescripts.co.uk

  • Billing of pre-selected orders in a specific sequence

    Hi,
      my customer uses manual data entry of sales orders with data he gets from a bunch of papers thus generating a lot of sales orders each day. When the time comes to bill these orders - one bill per order - of different content (customers, billing dates etc.), he selects them using a client specific report - depending on application oriented criteria - and wants them afterwards be billed in a background job / without any further user interaction in the sequence of the order numbers.
    The reason for it is, that he has to check the printed bills with the bunch of paper he used for data entry of the sales orders and he has to add some of these papers to the bills to be sent out via mail afterwards.
    So the sequence of both has to be the same for obvious reasons. The sequence of the bunch of papers is reflected in the sales order numbers, the sequence of the bills in the bill numbers. Bill numbers are generated internally thus depending on the sequence in which the sales orders were billed.
    I tried VF06 giving it sales order numbers to be billed in the proper sequence. But it seems that VF06 sorts these orders first by bill date and/or customers thus destroying the order of sales orders.
    Additionally I tried a couple of VF06 runs, one per sales order. But these runs are computed in parallel thus again destroying my preselected sequence. If I could change the job attributes of such a sequence ob VF06 jobs - one depending on the finishing of the prevoius one, this would solve the problem. But unfortunately the jobs are already "planned" so that I can't add a dependency between them after creation via VF06.  
    Does anyone has a good idea? Additions to my suggestions above? Or fresh and new ideas?
    Thank you very much in advance.
    GeraldS

    Hello Gerald,
    sounds like a quite curios process. 
    The standard transactions (VF04/VF06) are more or less written to deal with mass processing, so i don't think you could influence them the way you need.
    If you need the invoices in the order of the ordernumbers, the only way is to book them one by one using VF01.
    You could use a background job if you write a little own program performing these steps:
    - selecting order-Number to be billed,
    - sorting them
    - calling vf01 for each order via call transaction
      ( with Update option 'S') .
    Make sure that this program can only run  once in the system ( using an lock object).
    As a small solution that could work.
    A bigger (and better) solution would be scanning this 'bunch of paper', connecting the documents to the orders inside SAP.
    Regards Wolfgang

  • Working around the frame selection order issue in CS 4

    Hi guys,
    I'm trying to write a javascript in Indesign that will copy the contents of every selected text frame into the clipboard. The main problem is the selection order, since I'm using CS 4. I'm trying to work around the problem by writing the X and Y coordinates of every frame in arrays through a "for" loop, since the relevant order is always from top left to bottom right in my documents. However, I'm not sure what to do after sorting the arrays : how could I tell the program to use first the frame with the coordinates closest to 0, then the next, etc. ? So far I have this :
    var LesX = new Array();
    var LesY = new Array();
    var Blocs = app.selection;
    for (var i = 0; i < Blocs.length; i++) {
    var myBounds = Blocs[i].geometricBounds;
    var X = myBounds[1];
    var Y = myBounds[0];
    LesX.push(X);
    LesY.push(Y);
    LesX.sort(sortnum);
    Thanks a lot for your help!
    Ma

    Ths is not a good approach. your LesX array will be something like [90, 50, 30, 60, 20] before the sort. And after the sort it will be [20, 30, 50, 60, 90]. But that will not tell you how to find the object whose X value is 20.
    I would write it like this:
    function byYX(a,b) {
        var
            aY = a.geometricBounds[0],
            bY = b.geometricBounds[0],
            aX = a.geometricBounds[1],
            bX = b.geometricBounds[1],
            dy = bY-aY,
            dx = bX-aX;
        return dy?dy:dx;
    var blocs = app.selection;
    blocs.sort(byYX);

  • OM: Multi-select order lines to apply hold

    We are using Standard Oracle Multi-Select order lines (Ctrl or Shift keys) to apply hold and would like to pop-up an alert when any of the selected lines is having an open delivery. Appreciate any suggestions to handle this requirement. Thanks !

    These are good links for the Apply Hold functionalities.
    What we are looking for is to alert users that any of the multi-selected lines is having an open delivery/shipper.
    Need to identify the internal Line_id multi-selected by users for validating if there is an open delivery/shipper.
    Appreciate any advise.

  • Changing logical database DDF select order, and restricting the selection

    HI all,
    I am using logical database DDF for a report.  I would like to do two things:
    1) Change the sort order of records so that when my GET statements are processing, they are bringing the data back in sorted by a field of my choice (such as KNA1-REGIO, or KNB1-BUSAB).
    2) I would like to add KNA1-REGIO and KNB1-BUSAB as fields for selection during the LDB's initial selection, instead of filtering out records during the GET statements. 
    FYI, I did find the field DD_BUSAB in the LDB selection structure which I can use to restrict KNB1-BUSAB.  I am still not sure how to restrict by KNA1-REGIO though.
    Any thoughts?
    Thanks so much,
    L

    Thanks for the reply Shiba.  For that particular problem, the business wants to not have to use the dynamic selection, and just have KNA1-REGIO and KNB1-BUSAB as regular select options.  Like I said as well, I did find DD_BUSAB which I can use for KNB1-BUSAB, but KNA1-REGIO is still a problem. 
    Right now I just use a CHECK statement and filter kna1-regio after the GET kna1 statement.
    Thanks again,
    L

  • Dual Case Column names fail in select ORDER BY clause

    This one is solved, but I thought someone might be able to explain why it happens.
    I'm a newbie, since I just downloaded Oracel XE last night, and am trying it out.
    I set up a trivial table with 4 text columns. As it happened, I used dual case for some of my column names, such as 'Nickname'.
    When trying out the Query Builder, the Select statement failed whenever I added a sort.
    After some head scratching and back-and-forth with the sample data base (HR), I finally renamed all the columns to upper case. (e.g. column 'Nickname' became 'NICKNAME'). Then it works.
    Seems like a bug, but maybe it's just a feature. Here's the code generated by the Query Builder. As you can see, there are no quotes around the Table name or column names in the ORDER BY clause (and the dual case version of the column name works if I put the quotes in manually and run it with SQL command.) Seems quirky.
    select     "TEAMS"."NICKNAME" as "NICKNAME",
         "TEAMS"."CITY" as "CITY",
         "TEAMS"."DIVISION" as "DIVISION",
         "TEAMS"."CONFERENCE" as "CONFERENCE"
    from     "TEAMS" "TEAMS"
    order by TEAMS.NICKNAME ASC

    Welcome to forum. :)
    Now, answering your question - no i don't think this is a bug.
    It is your code - which create this bug.
    Now, question is - what happen?
    Just check your select and from clause. You put all the names are in double quote. When you put anything within double quotes - it become a case sensitive. So, the problem occurs there.
    Let's see ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    Elapsed: 00:00:01.11
    satyaki>
    satyaki>create table s_otn
      2      (
      3        id    number(4)
      4      );
    Table created.
    Elapsed: 00:00:02.14
    satyaki>
    satyaki>set lin 80
    satyaki>
    satyaki>desc s_otn;
    Name                                      Null?    Type
    ID                                                 NUMBER(4)
    satyaki>
    satyaki>desc S_OTN;
    Name                                      Null?    Type
    ID                                                 NUMBER(4)
    satyaki>
    satyaki>desc s_OtN;
    Name                                      Null?    Type
    ID                                                 NUMBER(4)
    satyaki>
    satyaki>drop table s_otn;
    Table dropped.
    Elapsed: 00:00:05.22
    satyaki>
    satyaki>
    satyaki>create table "S_otn"  
      2       (
      3         id     number(4)
      4       );
    Table created.
    Elapsed: 00:00:00.12
    satyaki>
    satyaki>
    satyaki>desc S_otn;
    ERROR:
    ORA-04043: object S_otn does not exist
    satyaki>
    satyaki>desc S_OTN;
    ERROR:
    ORA-04043: object S_OTN does not exist
    satyaki>
    satyaki>desc s_otn;
    ERROR:
    ORA-04043: object s_otn does not exist
    satyaki>
    satyaki>desc "S_OTN";
    ERROR:
    ORA-04043: object "S_OTN" does not exist
    satyaki>
    satyaki>desc "S_otn";
    Name                                      Null?    Type
    ID                                                 NUMBER(4)
    satyaki>Got me?
    Regards.
    Satyaki De.

  • Problem combining select, order by, rownum (top-N) and for update

    Hello,
    i have serious problems with this.
    -- drop table testtable;
    create table testTable (id number(10,0) primary key, usage number(10,10));
    -- delete from testtable;
    insert into testtable values (11, 0.5);
    insert into testtable values (10, 0.3);
    insert into testtable values (12, 0.3);
    insert into testtable values (9, 0.3);
    insert into testtable values (8, 0.9);
    insert into testtable values (3, 0.0);
    insert into testtable values (2, 0.02);
    insert into testtable values (1, 0.05);
    insert into testtable values (7, 0.7);
    insert into testtable values (6, 0.4);
    insert into testtable values (5, 0.2);
    insert into testtable values (4, 0.1);
    select * from testtable;
    -- without FOR UPDATE
    select * from (
    select tt.id id_, tt.*
    from testtable tt
    where tt.usage > 0.1
    order by tt.usage desc, tt.id desc
    where rownum <= 10;
    --> WORKS
    -- without ORDER BY
    select * from (
    select tt.id id_, tt.*
    from testtable tt
    where tt.usage > 0.1
    where rownum <= 10
    for update of id_;
    --> WORKS
    -- without WHERE ROWNUM <= 10
    select * from (
    select tt.id id_, tt.*
    from testtable tt
    where tt.usage > 0.1
    order by tt.usage desc, tt.id desc
    for update of id_;
    --> WORKS
    -- But what i need is this:
    select * from (
    select tt.id id_, tt.*
    from testtable tt
    where tt.usage > 0.1
    order by tt.usage desc, tt.id desc
    where rownum <= 10
    for update;
    --> ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc., SQL State: 42000, Error Code: 2014
    select * from (
    select tt.id id_, tt.*
    from testtable tt
    where tt.usage > 0.1
    order by tt.usage desc, tt.id desc
    where rownum <= 10
    for update of id_;
    --> ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc., SQL State: 42000, Error Code: 2014
    I have tried every single solution i could come up with.
    But nothing worked.
    My latest idea is to include a comment in the query and set up an ON SELECT trigger which evaluates the comment and enforeces the lock.
    But i'm not sure if this is even possible.
    I cannot split the statement into two because i need the lock immediately when the wanted rows are selected.
    One major criteria for the rows is the order by. Without it i get a random set of rows.
    And the rownum <= 10 is also needed because i don't want to lock the whole table but only the few needed rows.
    I tried row_number() over (order by ...) but this is considdered a window/group-function which disallows the for update as well as the order by.
    During these tests i noticed, that when using the row_number()-function the resultset is ordered automatically (without an additional order by clause).
    But this doesn't help anyway.
    I tried using piped functions to wrap the select to apply the rownum manually by cursor skip, but this doesn't work either. First of all i wasn't able to wrap the query the way i imagined and second the lock would be applied to the whole resultset anyway but only the reduced rows would be returned.
    I heared about LOCK-hints from other DBs, is there anything similar here?
    Any other solution??
    btw. it has to be high-performance after all.
    Greetings Finomosec;

    No, not perfect.
    This is the expected result (ordered by usage desc, id desc):
    ID     USAGE
    8     0.9
    7     0.7
    11     0.5
    6     0.4
    12     0.3
    10     0.3
    9     0.3
    5     0.2
    This ist the one produced by your statement:
    ID     USAGE
    5     0.2
    6     0.4
    7     0.7
    8     0.9
    9     0.3
    10     0.3
    11     0.5
    12     0.3
    Use limit 5 in your tests, and you will also notice that the following doesn't work either:
    select * from testtable ww where ww.id in
    select id from
    select tt.id, tt.usage
    from testtable tt
    where tt.usage > 0.1
    where rownum <= 5
    order by usage desc, id desc
    for update;
    It's because the order is not applied to the result.
    But the following modification works (at least principally):
    select * from testtable ww where ww.id in
    select id from
    select tt.id, tt.usage
    from testtable tt
    where tt.usage > 0.1
    order by usage desc, id desc
    where rownum <= 5
    order by usage desc, id desc
    for update;
    Thr problem here is:
    I need to expand the following Statement to the above form by (Java-) Code:
    -- statement-A
    select tt.id, tt.usage
    from testtable tt
    where tt.usage > 0.1
    order by usage desc, id desc;
    The main problem is:
    The order by clause needs to be duplicated.
    The problem here is, to identify it (if present) and NOT any order by in inner selects.
    I am using Hibernate and to implement this i have to modify the OracleDialect to solve this problem. I get the statement-A (see above) and have to apply the limit.
    Isn't there any other solution??
    Greetings Finomosec;

  • Select select order by

    Hi,
    If I have a table test_order_by with column c1, c2, c3, c4, for example. c1 and c2 together is primary key.
    If I run the following query,
    select * from test_order_by order by c1, c2;
    The result will be in the order of c1, c2.
    Now, If I run the following query:
    select * from (select * from test_order_by order by c1, c2);
    Will the result still be in the same order of c1, c2 ?
    Thank you.

    Hi,
    SQL> select * from emp order by deptno, empno;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7788 SCOTT      ANALYST         7566 09-DEC-82       3000                    20
          7876 ADAMS      CLERK           7788 12-JAN-83       1100                    20
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
    14 rows selected.
    SQL> select * from (select * from emp order by deptno, empno);
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7788 SCOTT      ANALYST         7566 09-DEC-82       3000                    20
          7876 ADAMS      CLERK           7788 12-JAN-83       1100                    20
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
    14 rows selected.SS

  • Select order by

    Hello everyone,
    I have an issue:
    I Know the aggregate function ORDER BY and I know we can specify the columns we need to put in order and if they have to be ASCENDING or DESCENDING
    But I'd like to create a "personal criterium", for example i have the rseg table and the field KSCHL, i want to order this field this way:
    KSCHL = ''
    KSCHL = FRA1'
    KSCHL = 'FRB1'
    KSCHL = 'ZK02'
    KSCHL = 'ZK05'
    KSCHL = 'ZFR2'
    KSCHL = 'ZIIP'
    KSCHL = 'ZII'
    I mean if I put DESCENDING or ASCENDING it won't be like this, but i need these last two types to be in the final and the type '' first.
    How can i achieve this?
    Thanks in Advance!

    I dont think so...that you can specify it in select statement....i.e. your own criteria..
    However what you can do is...
    Once you have the data in an internal table ....you need to loop it and transfer the data in another internal table which has one more field may be SORT_POSN...
    e.g. select*
          from dtable into gt_table.
    LOOP AT gt_table INTO gs_table.
    IF gs_table-kschl = ''.
        gs_final-SORRT_POSN = '1'.
    * Move all the other data from gs_Table into gs_final.
    APPEND gs_final TO gt_final.
    ENDIF.
    IF gs_table-kschl = 'FRA1'.
        gs_final-SORRT_POSN = '2'.
    * Move all the other data from gs_Table into gs_final.
    APPEND gs_final TO gt_final.
    ENDIF.
    IF gs_table-kschl = 'FRB1'.
        gs_final-SORRT_POSN = '3'.
    * Move all the other data from gs_Table into gs_final.
    APPEND gs_final TO gt_final.
    ENDIF.
    * Similarly do it for all other sort criterian...
    ENDLOOP.
    Now you have all the data in GT_FINAL..
    All you have to do now is, sort the internal table GT_FINAL BY SORT_POSN.
    Hope it helps!

  • SAP query field selection order and text

    Hello All,
       Is there any way I can change the position of fields on the selection screen of query. Also can I change the text of the selection fields. Thanks
    Atul

    In SQ01 enter your query name and go into change mode, on the menu click "Goto" , "Field Selection" then "Field Selection"
    in there change the text of selection field, to change to ordering just enter the number sequence in the "No" the order in which you want them to appear. Like
    Production Order 02
    Order Type       03
    Plant            01
    after you execute the query selection screen will appear like below
    Plant
    Production Order
    Order Type

Maybe you are looking for

  • Pages can´t open files saved in iCloud

    I can´t open any file save to iCloud I tried a workaraound: I couldn´t open a file save to iCloud from my iPad. I opened it from icloud.com and downloaded it to my iMac. Opened the downloaded file, and everything semed ok. I then closed the dokument

  • I am having difficulties with distributing a PDF Form.

    I am having difficulties with distributing a PDF Form. When I click the distribute button I choose the "Manually collect responses in my email inbox option" then press next, I select the "Save a local copy and manually send it later and then I specif

  • Automation of Closing Process

    Hello Our Client has a peculiar requirement of closing To extract Account Balances Profit Centrewise example Profit Centres                                                         P1                     P2                P3 Expenses in Profit & Loss 

  • Insecure Flash files in CS4 Design Premium

    Vista Home Premium SP1 CS4 Design Premium Downloaded and installed CS4 Design Premium. Ran the check for updates, found nine and installed them. Then I ran Secunia PSI which found the following insecure file versions within Adobe. I'm assuming they'r

  • OSA - Transport Appraisal Templates

    Hello, I would like to ask what is the best way of transporting an appraisal template from one client to another. I have checked a few related questions and their responses on this forum and the possible options appear to be a. Usage of RHMOVE30, or