do a select from table using order by ASC and recover only a range

Hello
I have a problem in my program and I want to know the line which is the cause in order to correct the code!

-There is a line between 19500 and 19600 lines that gives me an error.
-my program made a NLSSORT (my_field, ' nls_sort = binary "") AS "KEY1".

so I think that if I do something like that, I get the same order:

Select * from my_table
order my CSA my_field
where the rank number bettween 19500 and 19600

My problem:
I have no idea how to do this last part. does anyone know how to do this?
I was just trying to sort it out and then check out lines up to 19600, but I can't do that because there is no enough space in temp score.


Thank you.

Best regards
Ricardo Tomas
select col1, col2, col3...
from (select my_table.*, rownum rn
       from (select * from my_table
                order by my_field asc
             ) my_table
      )
where rn between 19500 and 19600

Note: you must order in a subselect before applying the rownum because the order is usually applied after the right column in a statement pseudo-device select rownum.

Tags: Database

Similar Questions

  • Problem with "select * from table" for dynamic IN the list

    I have a 'for loop' based a query that does not work. The query is supposed to return the name of the table, the data type and the name of the column in the columns poses a number of name filters. The problem I have is when I run the query into a TOAD with:

    schema_list value SCOTT, MED and the clause of 'in' as ' to (select * from table (DATAPUMP_UTIL.in_list_varchar2 (:schema_list))))»

    The query returns the expected lines.

    When I have it in my code as shown below it returns no rows. I don't know what hurts me, but any help would be great! I'm on Oracle 11.1.0.6.0.
    PROCEDURE export_schema_ondemand (schema_list VARCHAR2, encrypt_file NUMBER default 0, mask_sensitive_data NUMBER default 0) IS  
        ...
        schema_list_t := my_package.in_list_varchar2(schema_list);
        ... 
        for c1 in
           (
            with ok_to_mask as (
            select 
                owner,
                table_name, 
                column_name
            from   
               all_tab_columns
            where
                owner in (select * from table(schema_list_t))
            minus
            (SELECT 
                c.owner,
                p.table_name,
                cc.column_name
            FROM 
                all_cons_columns cc, 
                all_constraints p,
                all_constraints c
            WHERE 
                c.owner in (select * from table(schema_list_t))
                c.constraint_type = 'R'
                AND p.owner = c.r_owner
                AND p.constraint_name = c.r_constraint_name
                AND cc.owner = c.owner
                AND cc.constraint_name = c.constraint_name
                AND cc.table_name = c.table_name
            UNION ALL
            SELECT 
                c.owner,
                cc.table_name,
                cc.column_name
            FROM 
                all_cons_columns cc,
                all_constraints p,
                all_constraints c
            WHERE
                p.owner in (select * from table(schema_list_t))
                AND p.constraint_type in ('P','U')
                AND c.r_owner = p.owner
                AND c.r_constraint_name = p.constraint_name
                AND c.constraint_type = 'R'
                AND cc.owner = c.owner
                AND cc.constraint_name = c.constraint_name
                AND cc.table_name = c.table_name))
            select 
                atc.table_name as mask_tab, 
                atc.column_name as mask_col, 
                atc.data_type as mask_type
            from   
                all_tab_columns atc,
                ok_to_mask otm
            where
                atc.owner = otm.owner
                and atc.table_name = otm.table_name
                and atc.column_name = otm.column_name
                and atc.owner in (select * from table(schema_list_t))
                and 
                (
                atc.column_name like '%LAST%NAME%'
                or atc.column_name like '%FIRST%NAME%'
                or atc.column_name like '%NAME_LAST%'
                or  atc.column_name like '%NAME_FIRST%'
                or  atc.column_name like '%ENAME%'
                or atc.column_name like '%SSN%'
                or atc.column_name like '%DOB%'
                or atc.column_name like '%BIRTH%'
                )
                and atc.column_name not like '%PHYSICIAN_%'
                and atc.column_name not like '%DR_%'
                and atc.column_name not like '%PROVIDER_%'
                and atc.column_name not like 'PRESCRIBER_%'     
           )
          loop
             ...
    
    FUNCTION in_list_varchar2 (p_in_list  IN  VARCHAR2)  RETURN VARCHAR2_TT is
    
        l_tab   VARCHAR2_TT := VARCHAR2_TT();
        l_text  VARCHAR2(32767) := p_in_list || ',';
        l_idx   NUMBER;
            
    BEGIN
        LOOP l_idx := INSTR(l_text, ',');
            EXIT WHEN NVL(l_idx, 0) = 0;
            l_tab.extend;
            l_tab(l_tab.last) := TRIM(SUBSTR(l_text, 1, l_idx - 1));
            l_text := SUBSTR(l_text, l_idx + 1);
        END LOOP;
    
        RETURN l_tab;
            
    END in_list_varchar2;
    Published by: BluShadow on June 29, 2011 16:11
    addition of {noformat}
    {noformat} tags.  PLEASE READ {message:id=9360002} TO LEARN TO DO THIS YOURSELF.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    Hello

    If you have a query that works well when you launch it directly, and that breaks down when you start with a procedure, this can be a problem of privileges.

    Points of view ALL_ * shows only the objects you have access, but using a procedure, privileges must be granted directly to the user and not with a role.

    You should check the SELECT privileges to your user through roles and give them directly to the user.

    Hope this will help.

    Sylvie

  • Insert into MDQ_OLD select * from table (lt_monitorMdq);

    I'm trying to insert into a table that has only a single column, which is a column of a user defined type (UDT). The UDT is nested, that is one of the attributes of the UDT is an another UDT.

    I aim to insert into the table like this pseudo-code:

    INSERT INTO T1 SELECT * FROM THE UDT;

    CREATE TABLE MDQ_OLD (myMDQ UDT_T_MONITOR_MDQ)

    NESTED TABLE myMDQ

    (T1_NEW) ACE STORE

    THE NESTED TABLE MONITOR_MDQ_PRIM_RIGHTS

    STORE AS T2_NEW);

    The MONITOR_MDQ_CLI procedure. Read below returns the parameter lt_monitorMdq which is a UDT type as announced. The statement "insert into select MDQ_OLD * table (lt_monitorMdq);" fails, while the second insert statement works.

    Is it possible to get the first statement of work?

    I'm on Oracle 11 g 2.

    DECLARE

    lt_monitorMdq UDT_T_MONITOR_MDQ;

    BEGIN

    MONITOR_MDQ_CLI. Reading (TRUNC (SYSDATE),

    TRUNC (SYSDATE),

    NULL,

    NULL,

    "MILLION BTU.

    lt_monitorMdq); -Note lt_monitorMdq is an OUT parameter

    -This insert does not work

    Insert into MDQ_OLD select * from table (lt_monitorMdq);

    BECAUSE me in 1... lt_monitorMdq.count

    LOOP

    Dbms_output.put_line ('lt_monitorMdq: ' | .mdq_id lt_monitorMdq (i));

    -This integration works

    INSERT INTO MDQ_OLD (MYMDQ)

    VALUES (UDT_T_MONITOR_MDQ (UDT_R_MONITOR_MDQ)

    lt_monitorMdq (i) .gasday,

    1,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    () UDT_T_MONITOR_MDQ_PRIM_RIGHT

    () UDT_R_MONITOR_MDQ_PRIM_RIGHT

    1,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    (NULL)));

    END LOOP;

    END;

    have you tried:

    INSERT INTO MDQ_OLD (myMDQ) VALUES (lt_MonditorMDq);

    curiosity:

    Is there a particular reason, why you have created a table with a single column of type UDT instead of:

    CREATE TABLE... OF UDT_T_MONITOR_MDQ;

    I can tell you from experience that using a nested table, you can easily query the data in the nested table.

    MK

  • sort a single column in the order the asc and desc

    How can I write a query to sort a column in the order the asc and desc?

    I tried with the following query, but it gives an error-

    Select ename, (select ename from emp by ename desc) to order the CSA ename emp;

    You try to do this?

    SQL > ed

    A written file afiedt.buf

    1 with t as (select ename

    2, row_number() (any order by ename): the nurse

    3, count (*)-(row_number () () (any order by ename)-1) as the rn2

    4 of PEM

    5            )

    6. Select e1.ename

    7, e2.ename

    8 t e1

    Join 9 t e2 on (e1.rn = e2.rn2)

    10 * order by e1.rn

    SQL > /.

    ENAME ENAME

    ---------- ----------

    ADAMS WARD

    ALLEN TURNER

    BLAKE SMITH

    CLARK SCOTT

    FORD MILLER

    JAMES MARTIN

    KING JONES

    KING JONES

    MARTIN JAMES

    MILLER FORD

    SCOTT CLARK

    BLAKE SMITH

    ALLEN TURNER

    DISTRICT ADAMS

    14 selected lines.

    But why you want to do this, I don't know.

    Edited: to correct error in the code

  • Table not found, to: select * from EUL5_documents, using Oracle Developer

    Hello world

    Hope all is well,

    In a previous thread.
    Re: Can I export the query "database" to Excel?

    West of stem has provided the name of the discoverer table which contains the reports:
    EUL5_Documents.

    I went to Oracle Developer just to run a select statement on this table.
    (We use discoverer out of an ODS - data warehouse - like repository)

    So in Oracle developer, I signed in ODS and typed:
    Select * from EUL5_documents

    I typed EUL5_ a drop-down list of tables appear, so I chose EUL5_documents

    I get an error msg when I run the table is not found...

    All advice would be appreciated, tx, sandra

    Hi, Sandra
    You are probably using the SunGard ODS?

    If so, you must open a session as long as the owner of the EUL is not the owner of the ODS. In many cases, this account is ODSDISCO.

    You can tell by logging in to the administration tool. Any account that you use to connect there is one that you can use to query the underlying tables. EUL5_DOCUMENTS is definitely one you want to watch.

    Best wishes
    Michael

  • Extracting data from table using the date condition

    Hello

    I have a table structure and data as below.

    create table of production
    (
    IPC VARCHAR2 (200),
    PRODUCTIONDATE VARCHAR2 (200),
    QUANTITY VARCHAR2 (2000).
    PRODUCTIONCODE VARCHAR2 (2000).
    MOULDQUANTITY VARCHAR2 (2000));

    Insert into production
    values ('1111 ', '20121119', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20121122', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20121126', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20121127', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20121128', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20121201', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20121203', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20121203', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20130103', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20130104', ' 1023', 'AAB77',' 0002');

    Insert into production
    values ('1111 ', '20130105', ' 1023', 'AAB77',' 0002');


    Now, here I want to extract the data with condition as

    PRODUCTIONDATE > = the current week Monday

    so I would skip only two first rows and will need to get all the lines.

    I tried to use it under condition, but it would not give the data for the values of 2013.

    TO_NUMBER (to_char (to_date (PRODUCTIONDATE, 'yyyymmdd'), 'IW')) > = to_number (to_char (sysdate, 'IW'))

    Any help would be appreciated.

    Thank you
    Mahesh

    Hello

    HM wrote:
    by the way: it is generally a good idea to store date values in date columns.

    One of the many reasons why store date information in VARCHAR2 columns (especially VARCHAR2 (200)) is a bad idea, it's that the data invalid get there, causing errors. Avoid the conversion of columns like that at times, if possible:

    SELECT     *
    FROM     production
    WHERE     productiondate     >= TO_CHAR ( TRUNC (SYSDATE, 'IW')
                              , 'YYYYMMDD'
                           )
    ;
    
  • Very slow SELECT * FROM table

    Hello
    could you please help me, that's why execution of
    Select * from myTable very slow (more than an hour and running)?
    Table has 2 GB, BUT the use of the disc is only 5%!

    When I execute select count (*) from myTable, usage is 100% and I have the result in 1 minute...

    Thank you.

    Please see the nets [url http://forums.oracle.com/forums/thread.jspa?messageID=1812597#1812597] when your query takes too long... and [url http://forums.oracle.com/forums/thread.jspa?threadID=863295&tstart=0] HOW TO: post a request for tuning SQL statement - model of accounting. Maybe comment by Sybrand on accounting for the new trace files needs a qualification, as the work through the normal steps of setting before posting the raw trace.

    I think you might have some misconceptions about the work of parallel processing how and what to KEEP. You can also consult the manual of Concepts on when things go in the PGA, and when they go into the CMS and find out how to see the use of the PGA. If you try to load the buffers of the SGA by making a parallel with full table scan, it won't, because this combination uses your PGA and multiblock reads to increase performance - negative in some cases, such as yours.

    In other words, you're [url http://www.doingitwrong.com/wrong/585_munkavedelem.jpg] made wrong.

  • Insert into select * from table 3. -is on the agenda by the needless?

    I've got an example of script, it will work for any table, so I don't bother with the full ddl.

    ----------------------------------------------------------------------------
    create table test in select * from hotels where 1 = 2;

    Insert into test select * from Hotels by city;

    Select the city from the trial;

    -drop table test is serving;
    -----------------------------------------------------------------------------

    The amazing thing is, that the city is ordered alphabetically,
    but you would say it is that an operation order is irrelevant.

    Any ideas on that?

    This will still work?

    Edited by: FourEyes on December 8, 2008 22:55

    Edited by: FourEyes on 8 December 2008 22:56

    Edited by: FourEyes on 8 December 2008 22:56

    Hello

    The [SQL Oracle 10 language reference | http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9014.htm#sthref9371] manual says:

    «In regards to the ORDER BY clause from the subquery in the DML_table_expression_clause, you place your order is guaranteed only for the inserted rows and only within each extension table.» Orders new lines with regard to existing lines is not guaranteed. »

  • Select the table using script

    Hello

    The threshold of all selected tables in the document. I need to select a first table, then on next table etc...

    myTable var = app.activeDocument.tables.everyItem () .getElements ();

    Someone help me?

    I am again for the script. What should I do for this type of orders InDesign as I write scripts?

    Kind regards

    Vincent

    Try this,

    var myTable = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
    alert(myTable.length)//no. of tables in a document
    for(var i=0; i
    

    Vandy

  • How can I build a table using two digital controls and a button? Whenever I press the button, a column of 2 lines (digital orders) should be created.

    I tried several ways to date.

    I know that I can use the building to create a table of two numbers but I am not able to create a 2d in this way

    I also tried to use Replace subset of table, but still it won't work.

    I know that I have to use a table that has the index of the column starting with 0, so whenever I press the button of the column index incriments by 1 so the next column will change but I am not able to create this.

    You are the authority on what a Altenbach! He writes, I just did to make it work. Don't really consider this. Here's a modified version for the OP to use should he like:

  • deleting values from table using splice... back 2 skool 4 me.

    NSN

    I have a dim multi table that contains several values grouped.

    say [] table [1] has 4 different values.

    I tried to remove 1 set of values of this by using the function of the weld.

    1st thing I noticed is that the using array.length does not work because he gets dynamic altered after every junction. He would remove while half of the lines.

    No worries... the value .length moved a var before the loop. and hop...

    or... not really

    Now he always leaves 1 row behind in the table because the table index ends at beeing 1 (finally left and my loop counter is greater than.)

    So... I added a loopctr = 0 at the end of each splice for it will re-start the loop to the beginning of the table.

    Still does not work...

    Now, I get a runtime error on an object not existing... the value of something...

    Basically, my programming techniques are on dated apperently of... tweaking it until it works is to transform my spagetti code...

    Good food but a mess to clean up.

    So now... What I use is:

    make a temporary array, press in each row that is NOT what I wanted to delete.

    Zero of my table, and then copy the temp

    * My father just turned in his grave in disgust.

    Can someone tell me please the correct way to use splice? or any child model nesting list?

    Which is higher

    Mac

    You can use the Array.filter () method to do this:

    var myArray:Array = [];
    myArray.push([1, 1 , 0, 0, 1]);
    myArray.push([1, 1 , 0, 0, 1]);
    myArray.push([2, 1 , 1, 2, 1]);
    myArray.push([1, 1 , 0, 0, 1]);
    myArray.push([2, 1 , 0, 50, 1]);
    myArray.push([1, 1 , 0, 0, 1]);
    
    myArray = myArray.filter(arrayFilter);
    
    trace(myArray);
    
    function arrayFilter(element:Array, index:int, array:Array):Boolean {
        return element[0] != 2;
    }
    
  • Select * from TABLE (tst_name_pw.list);

    Windows XP + 10.2.0.1.0 Oracle

    I did tst_name_pw desc and show as below:

    PROCEDURE Argument name default input/output Type
    ------------------------------ ------------------------------ ---------------------------------------------------------- --------- -------
    (FUNCTION) < return value > TABLE LIST unknown


    I have don see the table as tst_name_pw or the list name in the database.
    Anyone it clarify it please?
    Thank you

    Hello

    782150 wrote:
    Windows XP + 10.2.0.1.0 Oracle

    I did tst_name_pw desc and show as below:

    PROCEDURE Argument name default input/output Type
    ------------------------------ ------------------------------ ---------------------------------------------------------- --------- -------
    LIST (FUNCTION) TABLE OF strangers

    I have don see the table as tst_name_pw or the list name in the database.
    Anyone it clarify it please?
    Thank you

    It seems that tst_name_pw is a package, not a table.

  • Select multiple files using File Explorer MP4 and play

    I play the videos which are MP4 and play using the video app Windows 8 when selected in the file Explorer. But she plays alone. When I select more than one file, I expect that they would not play in order. Is there a way to do this in Windows 8 as having been shipped?

    No, I'm not asking any interested by third-party tools.

    I play the videos which are MP4 and play using the video app Windows 8 when selected in the file Explorer. But she plays alone. When I select more than one file, I expect that they would not play in order. Is there a way to do this in Windows 8 as having been shipped?

    No, I'm not asking any interested by third-party tools.

    When using Windows 8 file Explorer, you see additional tools, when you select a video file?
     

    (Yes Yes - music, video, same difference.  Not my photo-, but it shows what I mean with the "add to playlist" and "play all the" options.)

  • Module_data using "order" ascending them and descending?  If so, how?

    As with the previous module tags (to help module_order for example), I have the ability to use sortType.  At a basic level, its supports some ascendant and descendant (date, datereverse).  So, is this possible with the attribute of 'order' module_data?

    I answered my own question (after some searching).  If you want to sort by a field, down just put a '-' before the name of the field.

    Example of

    order = ""-invoiceDate ' "

  • Selection of clip using not together audio and video, unrelated acts

    Something happened with my editor settings and I can't know what I did or how to fix it.

    using first Pro CC 2014.0.1.

    Whatever the project, when I select a clip in the timeline and try to move it, it only moves the audio or video (if I clicked it) (if that's what I clicked on) and abandon the linked audio file corresponding (or video). Almost as if you would normally select a clip to isolate the video audio using the Alt/Option (Mac) key. The audio and the video ARE LINKED and thus show in a pop-up, this isn't that video and audio are somehow regarded as irreversible first. It is just this way when I select an item.

    I must have changed something because he has never done this before and just started doing it. Must have hit a key combination to turn on or off certain settings, but I can't. I need to go back and select at the same time.

    Any suggestions? Thank you.

    This button-

    Causing the behavior that you comment on.  It is a toggle that allows to move a part of a related assets without moving the rest.

Maybe you are looking for

  • Need new HDD for my Satellite A60-723

    I have a laptop Satellite A60-723, the hard drive has crashed, so now the beach is empty. But I am now in the Canada, can I buy a hard drive for laptop normal 2.5 "and insert it? Where can I get instructions on how to do it? I can see the connections

  • How to extract of gain and offset by AnalogWaveform?

    Hello On a similar note to the posts at https://forums.ni.com/t5/High-Speed-Digitizers/How-are-offset-and-gain-in-the-niScope-fetch-function... and http://forums.ni.com/t5/High-Speed-Digitizers/Where-to-find-gain-and-offset-of-USB-5132-running-in-C..

  • How to read the voltage difference between the 2 pins of a RS232?

    Hi, I'm new in this field and I'm having a problem in the acquisition of data from a RS232 port. In fact, I don't know if it is possible to do. What I would do, is to read the voltage difference between the two pins of the port. It's because I want t

  • HP DV3: battery - plus.eu safe to use?

    HelloI just really need a replacement battery for my HP, but couldn't find http://www.battery-plus.eu as the only available option.The opinions or personal experiences with these guys here would be greatly appreciated.Thank youwishba

  • How can I reset my computer to factory settings

    original title: factory settings How can I reset my desktop to factory settings trying to avoid having to reformat my computer crashes, freeze and are very slow, I tried f10 at startup, do nothing please help :)