Default in "order by" in select query may be different in 11g from 10g

Hi, I am wondering if when you are querying a table in 11g and you use the order by clause and there is more than one occurrences with the same values in the order by, if the 11g default is different than from 10g.  For instance.
DECLARE MHBulk CURSOR FOR                       
  select invoice_nbr,
               customer_nbr,
                post_century,
                post_yymmdd,
     from CUSTOMERS
     where customer_nbr = 1234
     order by
           post_century,
           post_yymmdd;
If you have more than one occurrence of the same customer_nbr, post_century, and post_yymmdd it looks like the default order for how 11g retrieves the records is a bit different than the 10g default.   Does anyone know why this is?

JustinCave wrote:
In any version of Oracle, if your ORDER BY does not specify a completely unique order, the order in which ties are broken is arbitrary.  Realistically, it will depend on things like the specific query plan chosen, the physical order of data on disk, which parallel query slave read the row, etc.  So it is subject to change within the same version of the database when, for example, a query plan changes.  It is entirely plausible that the results would be returned in the same order for years and then suddenly change one day.  If you care about the order of ties, you should add additional logic to the ORDER BY clause that specifies the order you want rather than assuming that there is a "default" order applied.
Upgrading to a new version of Oracle, particularly if that was done via something like exporting and importing the data so that you're changing the Oracle version and the physical order of data and various object statistics, it is not at all unusual that you would get slightly different plans and that ties would be broken differently.  I wouldn't assume that there is a new "default" order, though.  It's entirely possible for the order to change if the query plan changes again.
Justin
Well, what happened is we've gotten a few new customers and those customers are on Linux oracle 11g.  All the other customers are on regular unix 10g.  So, it sounds like we've just been lucky with the order until now.  In our system we have a sequence number column which is unique and I solved this by adding that in the ORDER BY clause.  I was just curious as to whether oracle had a default when it found duplicate fields in the ORDER BY clause.  I can't imagine that oracle doesn't have a default like unique_session_id or something like that.

Similar Messages

  • Order by in select query

    Hi guys
    i am getting problem in my select query which is creating one long string, it is working fine without order by but when i run this with order by it get hanged. this query using on function to concatenate multiple strings in one string as well
    Please help me what i am doing wroing.
    select
    regexp_substr(pe.emp_id,'[0-9]+$') ||'|'||
    p.title ||'|'||
    cdt.text||'|'||
    j.tit||staff_pcb.host_pub_tit ||'|'||
    jou.vol ||pcb.vol||pcp.vol ||'|'||
    jou.journal_number||'|'||
    substr (jou.pages||pcb.pages||pcp.pages, 1, instr (jou.pages||pcb.pages||pcp.pages, '-')-1)||'|'||
    substr (jou.pages||pcb.pages||pcp.pages, instr (jou.pages||pcb.pages||pcp.pages, '-')+1)||'|'||
    pcb.st||jou.st||pcp.st||'|'||
    concat_aut(p.id)
    from pub p,journal j,caa c,person pe,class_t cdt,
    (select pcj.pub_id,pcj.vol,pcj.pages,pcja.st
    From pub_C_j_a pcja,pc_j pcj
    where pcja.pub_c_j_id = pcj.pub_id)jou,
    (select pcb.pub_id,pcb.host_pub_tit,pcb.pages,pcb.vol,pcba.st
    From pub_c_b pcb,pub_c_b_a pcba
    where pcba.pub_c_b_id = pcb.pub_id)pcb,
    (select pcp.pub_id,pcp.vol,pcp.pages,pcpa.st
    From pub_c_p pcp,pub_c_p_a pcpa
    where pcpa.pub_c_p_id = pcp.pub_id)pcp,
    where
    p.id = c.pub_id
    and c.person_id = pe.id
    and p.t_c_id = cdt.c_id
    and p.journal_id = j.id(+)
    and p.id = jou.publication_id(+)
    and p.id = pcb.publication_id(+)
    and p.id = pcp.publication_id(+)
    and substr(regexp_substr(pe.emp_id,'[0-9]+$'),1,2) in('77','78')
    and pcb.st||jou.st||pcp.st='1' order by pe.emp_id
    ;

    Not sure about why it's only hanging on order by but looks like your query causing full table scan because of this in WHERE clause:
    and pcb.st||jou.st||pcp.st='1'
    I would change it to something like:
    and ((pcb.st='1'  and jou.st = '' and pcp.st = '') or (jou.st='1'  and pcb.st = '' and pcp.st = '')  or (pcp.st='1'  and jou.st = '' and pcb.st  = '') )

  • Select query based on joining of tables from different database is taking too long

    Hi Team,
    Select query on table with millions of records is taking very long time. It took 50mins, the below query is joining on multiple table from two databases DB1.dbo.Table1 contains 100 million records and also Table3 and Table4 (of different database) might
    contain close to 1million records.
    Select T1.*
    From DB1.dbo.Table1 T1
    Join DB1.dbo.Table2 T2 on RTRIM(T1.Col3) = RTRIM(T2.Col3)
    Join Table4 CA on RTRIM(T1.Col1) + T2.Col2 = CA.Col1
    Join Table3 U on CA.Col2 = U.Col2 AND RTRIM(T2.Col2) = U.Col3
    Where U.Col4 NOT IN ('A1', 'A2', 'A3', 'A4', 'A5', 'A6','A7','A8','A9')
    And (T1.flg IS NULL OR T1.flg = 'N')
    And LTRIM(RTRIM(T2.Col2)) NOT IN ('B1','B2')
    How can i improve the performance of this query. Actual thing is update the data in Db1.dbo.table1 based on the conditions but if the select is taking close to 1hr then update will take hours together. Indexes already implemented on all the tables.
    Thanks,
    Eshwar.
    Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.

    Thanks.
    Join Table4 CA on RTRIM(T1.Col1) + T2.Col2 = CA.Col1
    This join is not working with spaces if Rtrim is not used.
    Thanks! Eshwar.
    Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.

  • Select query for 6 different tables with vbeln as same selction criteria

    Hi,
    I have a query..
    I am using 6 differnet tables with vbeln being the same primary key on the basis of which i have to match the data.
    I have assign vbeln with different name but in the select query it gives me the error that vbeln2 is not the correct field.
    Can anyone please suggest how can i use the different field name and read the data from the table.

    hi,
    Use alias name for fields / tables in select query, problem will solve
    Regards,
    Praveen Savanth.N

  • Issue with select query to fetch data using Join from two tabels

    Hello All-
    I want to fetch the ShowName as "SUN NIGHTLY NEWS" and EpisodeName as "091706"
    based on the condition a.TitleNo=b.TitleNo and a.seriesNo=b.TitleNo.
    If i use the only first condition-a.TitleNo=b.TitleNo than output is displayed as-
    SchedItemNo |      Showname|      EpisodeName
    2702154     |     091706     |     091706
    If i use the second Condition-a.seriesNo=b.TitleNo than Output is displayed as-
    SchedItemNo|     Showname      |     EpisodeName
    2702154     |     SUN NIGHTLY NEWS |     SUN NIGHTLY NEWS
    Than i tried following Query to use the Union based on two conditions:-
    Select distinct a.SchedItemNo,b.TitleName,b.TitleName as EpisodeName
    from ScheduleItem a,Titles b where a.TitleNo=b.TitleNo and
    a.ScheditemNo in ('2702154')
    Union All
    Select distinct a.SchedItemNo,b.TitleName,b.TitleName as EpisodeName
    from ScheduleItem a,Titles b where b.TitleNo=a.SeriesNo and
    a.ScheditemNo in ('2702154')
    than it display the following result-
    SchedItemNo|     Showname |     EpisodeName
    2702154     |     091706          |     091706
    2702154     |     SUN NIGHTLY NEWS |     SUN NIGHTLY NEWS
    Here also values are not what i want :(
    I want the result to be displayed as using SQL:-
    SchedItemNo |     Showname      |     EpisodeName
    2702154     |     SUN NIGHTLY NEWS |     091706
    Please help me out!
    Thanks in Advance for putting your efforts.Looking forward for your replies.

    SQL> create table scheduleitem
      2  as
      3  select 2702154 scheditemno, 1 titleno, 11 seriesno from dual
      4  /
    Tabel is aangemaakt.
    SQL> create table titles
      2  as
      3  select 1 titleno, '071706' titlename from dual union all
      4  select 11, 'SUN NIGHTLY NEWS' from dual
      5  /
    Tabel is aangemaakt.
    SQL> Select distinct a.SchedItemNo,b.TitleName,b.TitleName as EpisodeName
      2  from ScheduleItem a,Titles b where a.TitleNo=b.TitleNo and
      3  a.ScheditemNo in ('2702154')
      4  /
                               SCHEDITEMNO TITLENAME        EPISODENAME
                                   2702154 071706           071706
    1 rij is geselecteerd.
    SQL> Select distinct a.SchedItemNo,b.TitleName,b.TitleName as EpisodeName
      2  from ScheduleItem a,Titles b where b.TitleNo=a.SeriesNo and
      3  a.ScheditemNo in ('2702154')
      4  /
                               SCHEDITEMNO TITLENAME        EPISODENAME
                                   2702154 SUN NIGHTLY NEWS SUN NIGHTLY NEWS
    1 rij is geselecteerd.
    SQL> Select distinct a.SchedItemNo,b.TitleName,b.TitleName as EpisodeName
      2  from ScheduleItem a,Titles b where a.TitleNo=b.TitleNo and
      3  a.ScheditemNo in ('2702154')
      4  Union All
      5  Select distinct a.SchedItemNo,b.TitleName,b.TitleName as EpisodeName
      6  from ScheduleItem a,Titles b where b.TitleNo=a.SeriesNo and
      7  a.ScheditemNo in ('2702154')
      8  /
                               SCHEDITEMNO TITLENAME        EPISODENAME
                                   2702154 071706           071706
                                   2702154 SUN NIGHTLY NEWS SUN NIGHTLY NEWS
    2 rijen zijn geselecteerd.
    SQL> select a.SchedItemNo "SchedItemNo"
      2       , show.TitleName "Showname"
      3       , episode.TitleName "EpisodeName"
      4    from ScheduleItem a
      5       , Titles episode
      6       , Titles show
      7   where a.TitleNo = episode.TitleNo
      8     and a.SeriesNo = show.TitleNo
      9  /
                               SchedItemNo Showname         EpisodeName
                                   2702154 SUN NIGHTLY NEWS 071706
    1 rij is geselecteerd.Regards,
    Rob.

  • Query running for long post upgrade to Oracle 11g from 10g

    The below query is running for a very long time post upgrade of database from 10g to 11g.
    SELECT default_supplier
      FROM (SELECT pv.vendor_name || '-'
                   || pvsa.vendor_site_code default_supplier
              FROM mrp_item_sourcing_levels_v mislv,
                   mfg_lookups ml1,
                   mfg_lookups ml2,
                   mfg_lookups ml3,
                   mtl_system_items_b msib,
                   po_vendors pv,
                   po_vendor_sites_all pvsa
             WHERE msib.segment1 = :b1
               AND msib.organization_id = :b2
               AND mislv.inventory_item_id = msib.inventory_item_id
               AND mislv.organization_id = msib.organization_id
               AND ml1.lookup_type = 'MRP_SOURCING_RULE_TYPE'
               AND ml1.lookup_code = mislv.sourcing_rule_type
               AND ml2.lookup_type = 'MRP_ASSIGNMENT_TYPE'
               AND ml2.lookup_code = mislv.assignment_type
               AND pv.vendor_id = mislv.vendor_id
               AND pvsa.vendor_site_id = mislv.vendor_site_id
               AND pvsa.vendor_id = mislv.vendor_id
               AND ml3.lookup_type = 'MRP_SOURCE_TYPE'
               AND ml3.lookup_code = mislv.sourcing_level
               AND mislv.sourcing_level =
                      (SELECT MIN (sourcing_level)
                         FROM mrp_item_sourcing_levels_v
                        WHERE inventory_item_id = msib.inventory_item_id
                          AND organization_id = msib.organization_id)
            UNION
            SELECT ood.organization_code default_supplier
              FROM mrp_item_sourcing_levels_v mislv,
                   mfg_lookups ml1,
                   mfg_lookups ml2,
                   mfg_lookups ml3,
                   mtl_system_items_b msib,
                   org_organization_definitions ood
             WHERE msib.segment1 = :b1
               AND msib.organization_id = :b2
               AND mislv.inventory_item_id = msib.inventory_item_id
               AND mislv.organization_id = msib.organization_id
               AND ml1.lookup_type = 'MRP_SOURCING_RULE_TYPE'
               AND ml1.lookup_code = mislv.sourcing_rule_type
               AND ml2.lookup_type = 'MRP_ASSIGNMENT_TYPE'
               AND ml2.lookup_code = mislv.assignment_type
               AND ml3.lookup_type = 'MRP_SOURCE_TYPE'
               AND ml3.lookup_code = mislv.sourcing_level
               AND ood.organization_id = mislv.source_organization_id
               AND mislv.sourcing_level =
                      (SELECT MIN (sourcing_level)
                         FROM mrp_item_sourcing_levels_v
                        WHERE inventory_item_id = msib.inventory_item_id
                          AND organization_id = msib.organization_id))
    From the trace files, we see that the issue is with the seeded view, mrp_item_sourcing_levels_v.
    Need pointers for fixing the performance.    

    The ETRM says this about the view:
    ***** Warning: Oracle Internal Use Only *****
    Oracle Corporation does not support access to Oracle
    applications data using this object, except from standard Oracle Applications programs.
    which is a powerful suggestion that you should not be addressing this view directly. Looking at the source code for the view, it has a bunch of UNIONs that may prevent view merging, and all the queries have loads of hints coded within them. So really, there is little you can do about this.
    It looks pretty simple to re-write your query to avoid addressing this view, you are using it only to retrieve a couple of columns. If you look at the source code for the view you'll see that you can get them easily without going through the view.
    John Watson
    Oracle Certified Master DBA

  • Column order in a select * query

    Suppose I have 256 columns in a table and if I query select * from  tablename ,what will the column order in the result.Will this be always same as order as in created statement?

    If the columns were all in the original CREATE TABLE statement, then, yes, the ordering of columns in SELECT * FROM will match the order from the CREATE TABLE statement.
    If columns were added after the initial create, then the original columns will come first (in their order) and then the added columns (in their order), etc.
    In the real world, it is a very bad practice to use SELECT * and have expectations about the ordering of the columns. Consider this scenario:
    Table T was created and implemented in production a year ago with columns A, B, C
    A project started up three months ago and added column D but the project is stalled in development. So in development T had columns A, B, C, D
    Later, another project started up and added columns E and F. Unlike the other project, it has progressed to Test. and Production. So in Development the table has columns A, B, C, D, E, F. In test and production the table has columns A, B, C, E, F.
    Now that stuck project has progressed to Test and Production. Now T has columns A, B, C, E, F, D in test and production but still A, B, C, D, E, F in development.
    Until someone notices and decides to fix it (where and how?)
    Be very, very careful about using SELECT *.

  • Difference in Query Formation in different environment in OBIEE 10g

    Hi All,
    I have a report where in I am pulling around 80 columns from different dimension tables and a fact table.
    In QA environment the report takes around 8 minutes and the query formed starts with (a With clause) . The query formed takes around 5 minutes to display the results in SQL developer.
    When i use the same RPD in my local system the same report takes 1 minutes to display and we get a simple query. The query formed in this case just takes 5 secs to display in sql developer.
    My question is why is the difference in the Query formation even if the RPD is same in both the environment.
    Please advice.
    Thanks,
    Krishna

    Hi,
    One of the things I am aware of which controls the usage of WITH clause is few database features parameters which are set up in RPD. You can refer below link for the same.
    http://gerardnico.com/wiki/dat/obiee/vertical_fragmentation_sql
    Also, in the above link, there are some links at the bottom of the page. Those also have some information regarding scenarios where WITH clause is generated and where it is not.
    Thanks

  • Strange results with Insert statement having select query

    Hi all,
    I am facing a strange issue with Insert statement based on a select query having multiple joins.
    DB- Oracle 10g
    Following is the layout of my query -
    Insert into Table X
    Select distinct Col1, Col2, Col3, Col4, Function(Col 5) from Table A, B
    where trunc(updated_date) > = trunc(sysdate-3)
    and join conditions for A, B
    Union
    Select Col1, Col2, Col3, Col4, Function(Col 5) from Table C, D
    trunc(updated_date) > = trunc(sysdate-3)
    and join conditions for C, D
    Union
    .... till 4 unions. all tables are residing in the local Database and not having records more than 50,000.
    If I execute above insert in a DBMS job, it results into suppose 50 records where as if I execute the select query it gives 56 records.
    We observed following things-
    a) no issue with size of tablespace
    b) no error while inserting
    c) since query takes lot of time so we have not used Cursor and PLSQL block for inserting.
    d) this discrepancy in number of records happens frequently but not everytime.
    e) examined the records left out from the insert, there we couldn't find any specific pattern.
    f) there is no constraint on the table X in which we are trying to insert. Also tables A, B, C....
    I went through this thread -SQL insert with select statement having strange results but mainly users are having either DB Links or comparison of literal dates, in my case there is none.
    Can somebody explain why is the discrepancy and what is the solution for it.
    Or atleast some pointers how to proceed with the analysis.
    Edited by: Pramod Verma on Mar 5, 2013 4:59 AM
    Updated query and added more details

    >
    Since I am using Trunc() in the where clause so timing should not matter much. Also I manually ruled out records which were updated after the job run.
    >
    The first rule of troubleshooting is to not let your personal opinion get in the way of finding out what is wrong.
    Actually this code, and the process it represents, is the most likely CAUSE of the problem.
    >
    where trunc(updated_date) > = trunc(sysdate-3)
    >
    You CANNOT reliably use columns like UPDATED_DATE to select records for processing. Your process is flawed.
    The value of that column is NOT the date/time that the data was actually committed; it is the date/time that the row was populated.
    If you insert a row into a table right now, using SYSDATE (8am on 3/5/2013) and don't commit that row until April your process will NEVER see that 3/5/2013 date until April.
    Here is the more typical scenario that I see all the time.
    1. Data is inserted/updated all day long on 3/4/2013.
    2. A column, for example UPDATED_DATE is given a value of SYSDATE (3/4/2013) in a query or by a trigger on the table.
    3. The insert/update query takes place at 11:55 PM - so the SYSDATE values are for THE DAY THE QUERY BEGAN
    4. The data pull begins at 12:05 am (on 3/5/2013 - just after midnight)
    5. The transaction is COMMITTED at 12:10 AM (on 3/5/2013); 5 minutes after the data pull began.
    That data extract in step 4 will NEVER see those records! They DO NOT EXIST when the data pull query is executed since they haven't been committed.
    Even worse, the next nights data pull will not see them either! That is because the next pull will pull data for 3/5/2013 but those records have a date of 3/4/2013. They will never get processed.
    >
    Job timing is 4am and 10pm EST
    >
    Another wrinkle is when data is inserted/updated from different timezones and the UPDATED_DATE value is from the CLIENT pc or server. Then you can get even more data missed since the client dates may be hours different than the server date used for the data pull process.
    DO NOT try to use UPDATED_DATE type columns to do delta extraction or you can have this issue.

  • Select query or RH_READ_INFTY?

    Hello experts,
    I have a report where I am fetching the Work schedule(IT 0007) for all employees for all the period. I have written a select query for the same. I am planning to replace it with FM RH_READ_INFTY. Since I am not using LDB, I cannot use Macros to read data.
    I ran a trace using both to find performances of both, but couldnt actually figure out as it doesnt show the time taken by FM. Instead it shows select queries fired on PA0007 table(which I am doing in first place).
    So please guide me as to which approach I should follow in this or any general case when it comes to reading IT data without using LDB.
    Thanx!,
    HOward.

    Hello Marcin,
    Thankyou for your valuable response.
    I guess you would be calling this fm for each EE separately
    Yes. I am looping on all PERNRs and have to fetch data for around 4-6 infotypes for each employee.
    So I guess I will have to use this FM 4-6 times for each employee. Even with the FM, it must opening a database connection.
    I feel, it would be as bad as firing select queries inside a loop.
    The custom select can be optimzed to establish the communication
    with DB only once for whole population (which of course means more complicated
    query to analyze by DB Optimizer but the data would be transported in one run).
    As you said,
    What I have done is, fired queries on all PA tables for respective infotypes and fetched the all the data in one shot.
    Later I have used READ statement to get the data I want.
    It really depends on your requirement. If you go for custom select query,
    you just extract specific information from the system skipping all the authorization checks,
    That might be a crucial issue. What  are the authorization checks here we are talking about?
    Does the FM read data from any
    other tables than we do in select queries?
    Thnx!
    Howard

  • Fast refersh materialized view having group by in it's select query

    Hi,
    Can any one please tell me from which version of Oracle we can create a fast refresh materialized materialized view having group by in it's select query.
    Regards,
    Koushik

    i dont know from which version this feature is started but I know that
    in 9i it works and we implemented for DWH projects

  • Workflows and select query

    hi all....
    i want to write a select query in workflow to fetch value from a table which i will be saving in workflow container... i cannot create a business object.... what else can i do... i dont hav exp with classes too.... advise some easy way out.....
    <Thread moved from ABAP General>
    Edited by: Mike Pokraka on Aug 27, 2008 12:47 PM

    Hello Sharma,
    Write a program in which you can give your select query and call the FM, SWU_START_WORKFLOW
    e.g.:
    CALL FUNCTION 'SWU_START_WORKFLOW'
      EXPORTING
        task                  = task
    *   LANGUAGE              = SY-LANGU
        user                  = user
    *   SENDER_ID             = SENDER_ID
    * IMPORTING
    *   RETURN_CODE           = RETURN_CODE
    *   WORKITEM_ID           = WORKITEM_ID
      TABLES
    *   CONTAINER             = CONTAINER
    *   MESSAGE_LINES         = MESSAGE_LINES
        attachment_list       = attachment_list
    Here, in the CONTAINER, pass the workflow container values.
    Give the respective task number and user as sy-uname.
    Regards
    Indu

  • Select query gives result in abc order instead of creation order

    Hi,
    I used the following command in sql command window to insert some rows to my table:
    SQL>
    SQL> insert into regions (Region_ID, Region_Name) values (1 , 'Zafon');
    1 row inserted
    SQL> insert into regions (Region_ID, Region_Name) values (2 , 'Hasharon');
    1 row inserted
    SQL> insert into regions (Region_ID, Region_Name) values (3 , 'Merkaz');
    1 row inserted
    SQL> insert into regions (Region_ID, Region_Name) values (4 , 'Jerusalem');
    1 row inserted
    SQL> insert into regions (Region_ID, Region_Name) values (5 , 'Hashfela');
    1 row inserted
    SQL> insert into regions (Region_ID, Region_Name) values (6 , 'Darom');
    1 row insertedWhen I use select * query to see the table, I get the content in abc order:
    SQL> SELECT * FROM REGIONS;
    REGION_ID REGION_NAME
            6 Darom
            2 Hasharon
            5 Hashfela
            4 Jerusalem
            3 Merkaz
            1 Zafon
    6 rows selectedHow can I get the result in the creation order (first created- first shown)?
    Thanks

    >
    How can I get the result in the creation order (first created- first shown)?
    >
    You can't - not unless you use a solution that you should NEVER use unless absolutely necessary.
    WHY do you need to do this? You never provide a reason.
    To get a result in creation order there are two requirements:
    1. Use an ORDER BY when you query the table - this is the only requirement others have mentioned
    2. Control and specify the creation order when you INSERT the data
    Unfortunately there is only ONE way that I am aware of to implement #2 above (i.e. to control the insertion order) and that is to SERIALIZE the insertion of rows into the table. That means that only ONE user can insert rows into the table at a time perhaps by using a stored procedure to perform the insert.
    In a multi-user system a USER can NOT see uncommitted data of other users. If a user uses a trigger and a SEQUENCE generator to generate ascending numbers another user can use that same trigger and sequence to generate numbers also. If the first user performs an INSERT and gets number 37 but doesn't commit a second user can perform an INSERT, get number 38 and COMMIT before the first user commits.
    That means that the row with 38 was created (committed) first but has a higher sequence than the row with 37.
    The best you can do is use a sequence generator to generate unique ascending numbers. Then you can query the data using an ORDER BY on the column that contains the sequence value. But, as shown above, that doesn't guarantee that the rows were actually committed in that order.
    That may sound like a trivial distinction but it has a very important implication. It means that you can NOT use that sequenced column to extract data reliably for batch-type processing. For the above example supposed your batch process extracted data for values from 1 to 38 and then that first user did a COMMIT.
    The next extract would be for values from 39 to 50 (or some other value) and the row with 37 would never be extracted. For the same reasons you can't use a CREATION_DATE value for such extract purposes either since you would have the same issue.

  • To select particular rows from order by select query

    Hi all,
    I want to select particular rows from a order by select query like...
    select * from emp order by ename;
    If i pass 3 and 7 dynamically in where clause or something like that, it has to show rows from 3 to 7 only.
    Thanks in advance
    Pal

    This?
    SQL> select *
    from (
       select e.*,
          row_number() over (order by ename) rn
       from emp e)
    where rn in (3,7)
    EMPNO ENAME      JOB         MGR HIREDATE         SAL       COMM     DEPTNO RN
    7698 BLAKE      MANAGER    7839 01-MAY-81       2850                    30  3
    7566 JONES      MANAGER    7839 02-APR-81       2975                    20  7
    2 rows selected.

  • Select query for sales order for particular customer oder text and storage

    Hi All,
    I am trying to retriev customer order text and customer storage bin from the following select query, but it's giving huge number of records, I want to restrict the number of records.
    Select customer order text, customer storage bin
                       Select STXH–TDOBJECT, STXH–TDID
                       Where  TDOBJECT = VBBP
                              TDID = Y001
                              TDID = Y007
    Please let me know how to restirct the number of records.
    Thanks,
    Ranjan

    Try using the FM 'READ_TEXT'.
    NAME will be the order number concatenated with the item number.
    And you have the ID and OBJECT.  You may also need to use the LANGUAGE.
    Message was edited by:
            Matt Nagel

Maybe you are looking for