How to receive a part of cursor together with total count of records

Hello for all!
I have table with 5 millions of records. This table has varchar2 field.
I need look into this table by this field with using LIKE '%something%'. I.e. I need search by free substring in varchar2 field.
Because my table has serious record count then this query runs during 5-20 seconds and can return serious amount of records (for example 300.000 records).
I don't want to receive 300.000 records in the user program which runs on user desktop computer. I want receive records by page. I.e. by chunks with 100-200 records.
I can use following query:
select * from
(select rownum rn, t1.* from table1 t1 where field1 like '%something%' order by field2)
where rn between 100 and 200
This query can return only needed records from total cursor.
But in this case I don't know total records quanity. But I should show to user total quantity of pages!
I can run query twice. I.e. first time I can run "select count(*) ", next time I can "select * ". But it means that Oracle should process two queries instead of one. This is not good desigion.
Please suggest me something useful for solving this problem.
Thank you,
Best regards,
Eugeny

I can use following query:
select * from
(select rownum rn, t1.* from table1 t1 where field1 like '%something%' order by field2)
where rn between 100 and 200That is not correct.
http://asktom.oracle.com/pls/ask/f?p=4950:8:5368894803981003723::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:127412348064
But in this case I don't know total records quanity. But I should show to user total quantity of pages!That is not a good idea.
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:127412348064#14136093079164

Similar Messages

  • How to find total count of records in a cursor

    Aassume below is the cursor i defined
    cursor c1 is select * from emp;
    now, i want to find the total count of records in this cursor using an existing function etc., using one line statement.
    FYI: c1%rowcount is always giving 0, so i cant rely on this.
    Any thoughts, please share.
    Thanks in advance.

    I am just showing this to show how to get the rowcount along with the cursor, if the program has so much gap of between verifying the count(*) and opening the cursor.
    Justin actually covered this, he said, oracle has to spend some resources to build this functionality. As it is not most often required, it does not makes much sence to see it as a built-in feature. However, if we must see the rowcount when we open the cursor, here is a way, but it is little bit expensive.
    SQL> create table emp_crap as select * from emp where 1 = 2;
    Table created.
    SQL> declare
      2   v_cnt     number := 0;
      3   zero_rows         exception;
      4  begin
      5    for rec in (select * from (select rownum rn, e.ename from emp_crap e) order by 1 desc)
      6     loop
      7        if v_cnt = 0 then
      8           v_cnt := rec.rn;
      9        end if;
    10     end loop;
    11     if v_cnt = 0 then
    12        raise zero_rows;
    13     end if;
    14   exception
    15    when zero_rows then
    16      dbms_output.put_line('No rows');
    17   end;
    18  /
    No rows
    PL/SQL procedure successfully completed.
    -- Now, let us use the table, which has the data
    SQL> declare
      2   v_cnt     number := 0;
      3   zero_rows         exception;
      4  begin
      5    for rec in (select * from
      6          (select rownum rn, e.ename from emp e)
      7          order by 1 desc)
      8     loop
      9        if v_cnt = 0 then
    10           v_cnt := rec.rn;
    11           dbms_output.put_line(v_cnt);
    12        end if;
    13     end loop;
    14     if v_cnt = 0 then
    15        raise zero_rows;
    16     end if;
    17   exception
    18    when zero_rows then
    19      dbms_output.put_line('No rows');
    20   end;
    21  /
    14
    PL/SQL procedure successfully completed.Thx,
    Sri

  • How to query a table and result together with autonumber

    Hi all
    How to query a table and the result return autonumber for each row together with the table values.
    I have tried rowid but it provide me with characters.
    Tj

    What is your exact requirement?
    If you want the number of rows selected, you can use rownum.
    select rownum, a.* from <table> a;
    Cheers
    Deepak

  • How do I power down my NAS together with my mac?

    Hi all,
    Recently I bought a Seagate Business Storage NAS (2 bays, each 2 TB).
    In the server settings, there is an option where I can shut down and start the NAS at a certain hour. Nevertheless this only shuts down the hard discs and not the whole NAS (it has a quite noisy fan).
    Is there a possiblity where I can shut down the NAS together with my MacBook or at a certain time point that I can set via my mac?
    Thanks in advance
    Michaël Duwyn

    Isn't this question better directed to a Seagate support forum?

  • How can i replace parts of my laptop with better parts

    I got a HP pavilion G6 . And i dont have the money to buy a new pc, so my question is, can i replace some parts with better ones, so i can have a better game expierience. And are there ways to boost my FPS? 
    Thanks 
    Niels

    Nielsdg wrote:
    I got a HP pavilion G6 . And i dont have the money to buy a new pc, so my question is, can i replace some parts with better ones, so i can have a better game expierience. And are there ways to boost my FPS? 
    Thanks 
    Niels
    NO. You will have to spend a good deal of money to get a high FPS machine and those aren't cheap to get.
    I am a Volunteer to help others on here-not a HP employee.
    Replies aren't online 24/7 because of Time Zone differences.
    Remember in this Day and Age of Computing the Internet is Knowledge at your fingertips if you choose understand it. -2015-

  • How can I control cc1 and cc7 together with my modwheel?

    I would like to control controller cc1 (dynamics) and cc7 (Volume) at the same time with my midi keyboard modwheel, I believe I can make this happen with the help of a transformer object in the envirement, but am not sure. Anyone knows how to do this?
    André

    Understanding Home Sharing:  http://support.apple.com/kb/HT3819
    iTunes: Setting up Home Sharing in your computer, http://support.apple.com/kb/HT4620
    Troubleshooting Home Sharing:  http://support.apple.com/kb/TS2972

  • How can I use one iTunes libary together with PC and Mac?

    I do have started to collect my iTunes file on a Mac now, I do have a Mac PowerPC and a PC Notbook. I try to establish a homenetwork and tried to estabilish an external hard drive with the iTunes database. But I do something wrong. It does not work. Please give me a detailed solution. Thanks

    Understanding Home Sharing:  http://support.apple.com/kb/HT3819
    iTunes: Setting up Home Sharing in your computer, http://support.apple.com/kb/HT4620
    Troubleshooting Home Sharing:  http://support.apple.com/kb/TS2972

  • How to put many documents in one file with words count

    HHow to put many documents in one file with words count

    Pdfs have no concept of words. Combining pdfs cannot be done with Reader. You need either Acrobat on a Mac or PC or perhaps with the PDF Pack service.

  • How can i find total no of records in a cursor

    Hi
    Its very helpful if anybody reply my doubt
    I have a cursor declared in a procedure.
    i opened that cursor, i want to know the count of records in the opened cursor, means total count of records.
    is it possible??
    Pls reply ASAP

    HI,
    this is a simple example with a cursor over user_tables view:
    set serveroutput on
    DECLARE
       CURSOR c_test IS
          SELECT table_name FROM user_tables;
       type t_reg is table of varchar2(30);
       l_reg t_reg;
    BEGIN
       OPEN c_test;
       fetch c_test bulk collect into l_reg;
       dbms_output.put_line(c_test%ROWCOUNT);
    END;
    /Output:
    SQL>
    SQL> set serveroutput on
    SQL> DECLARE
      2     CURSOR c_test IS
      3        SELECT table_name FROM user_tables;
      4     type t_reg is table of varchar2(30);
      5     l_reg t_reg;
      6  BEGIN
      7     OPEN c_test;
      8 
      9     fetch c_test bulk collect into l_reg;
    10 
    11     dbms_output.put_line(c_test%ROWCOUNT);
    12  END;
    13  /
    42
    PL/SQL procedure successfully completed
    SQL> Regards,
    Edited by: Walter Fernández on Nov 29, 2008 8:59 AM - Adding output...

  • Duplicate a layer together with its effects

    Hi,
    When I am duplicating a layer by layerRef.duplicate(newDoc) it is copied without its assigned layer effects.
    How is it possible to duplicate layers together with its effects?
    Or ideally how could I manage to duplicate the layer together with all associated settings like transparency, effects, blendMode, etc.?
    Thanks, Philipp

    It cant be done . You have to write a z pogram to update the data in the new dbtable.

  • How do I put parts of multiple songs into one song?

    I'm trying to make a mix of songs for my friends party and I was wondering how I could put parts of multiple songs together into one soundfile? If iTunes can't do this are their any other softwares that could do this? Thanks, appreciate it.

    Prosper,
    That is beyond the ability of iTunes, and requires the use of an audio editor.
    A free one that many people like is Audacity.
    After you do the editing in Audacity, you can export an MP3 and add it in to your iTunes library.  The original files remain unchanged.

  • How to receive XML from Flex HTTP POST

    Hi,
    We curreontly have a setup where we have a FLEX frontend send an XML through a HTTP POST and awaiting a response also in XML. On the backend this is handled relatively simply by a PHP script that basically does the following:
    read data (in XML)from FlEX HTTP POST into a new temp XML file.
    execute a c++ program with the XML file as one of the parameter.
    return the result to FLEX
    We have decided to move to BlazeDS for various reasons.
    Looking at the examples bundled with BlazeDS they have a jsp example that returns an XML result to FLEX so that part is fine. I am trying to find an example of JSP (or Servlet) that is able to read the XML data from FLEX and write it into a temp XML file. I would then try to use runtime.exec to invoke a local C++ program to process the XML file the result of which will be sent back to FLEX.
    Any help will be very much appreciated!

    <div class=Section1><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>I&#8217;d avoid calling an executable just to process XML &#8211;your<br />application server would provide enough support for reading and writing XML, no?<br />Also, if you&#8217;re only planning on working with XML then even BlazeDS might<br />be overkill because its focus is on sending strongly typed ActionScript data efficiently<br />to and from a client (it&#8217;s true that it does have a proxy service, but<br />that is not involved with processing the actual XML data).<o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>How complex is your XML? Do you need to resolve ids and<br />references or can you parse it top down in a single pass? There are several<br />well known libraries in Java for dealing with XML &#8211; the choice depends on<br />how you need to interact with the XML. Most of them take an InputStream as a<br />source for reading XML and you can get the InputStream from the servlet<br />request. Googling should turn up numerous examples.<o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>Pete<o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'><br /><br /><div><br /><br /><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><br /><br /><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span<br />style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> khwong<br />[mailto:[email protected]] <br><br /><b>Sent:</b> Sunday, September 28, 2008 12:09 PM<br><br /><b>To:</b> [email protected]<br><br /><b>Subject:</b> How to receive XML from Flex HTTP POST<o:p></o:p></span></p><br /><br /></div><br /><br /></div><br /><br /><p class=MsoNormal><o:p> </o:p></p><br /><br /><p class=MsoNormal style='margin-bottom:12.0pt'>A new discussion was started by<br />khwong in <br><br /><br><br /><b>General Discussion</b> --<br><br />  How to receive XML from Flex HTTP POST<br><br /><br><br />Hi, <br><br /><br><br />We curreontly have a setup where we have a FLEX frontend send an XML through a<br />HTTP POST and awaiting a response also in XML. On the backend this is handled<br />relatively simply by a PHP script that basically does the following: <br><br /><br><br />read data (in XML)from FlEX HTTP POST into a new temp XML file. <br><br />execute a c++ program with the XML file as one of the parameter. <br><br />return the result to FLEX <br><br /><br><br />We have decided to move to BlazeDS for various reasons. <br><br /><br><br />Looking at the examples bundled with BlazeDS they have a jsp example that<br />returns an XML result to FLEX so that part is fine. I am trying to find an<br />example of JSP (or Servlet) that is able to read the XML data from FLEX and<br />write it into a temp XML file. I would then try to use runtime.exec to invoke a<br />local C++ program to process the XML file the result of which will be sent back<br />to FLEX. <br><br /><br><br />Any help will be very much appreciated! <o:p></o:p></p><br /><br /><div class=MsoNormal><br /><br /><hr size=2 width=200 style='width:150.0pt' align=left><br /><br /></div><br /><br /><p class=MsoNormal style='margin-bottom:12.0pt'>View/reply at <a<br />href="http://www.adobeforums.com/webx?13@@.59b69b23">How to receive XML from<br />Flex HTTP POST</a><br><br />Replies by email are OK.<br><br />Use the <a<br />href="http://www.adobeforums.com/webx?280@@.59b69b23!folder=.3c061a83">unsubscribe</a>< br />form to cancel your email subscription.<o:p></o:p></p><br /><br /></div><br /><br /></div>

  • How to send excisable parts of m/c for repairing outside the plant

    hi guru's
       the scenario is that, we have purchased a machine. so we have machine in our inventory as our asset. but now a part of machine (which is not mentioned seperately in our inventory) has to be sended for repairing.
           now the problem is without the stock of that part how to send it outside
    pls let me know the soln asap
    ujwal

    Hi,
    Generally, Repair of Materials are handled via concept of Gate Pass (Returnable & Non-Returnable). But, SAP doesn't provide any option for creating Gate Pass (Returnable & Non-Returnable) in standard.
    Try the below suggested procedure as a work around process;
    Repair Process via Returnable Gate Pass: -
    1. MM01 - Create Material Master for every Spare Part / Machinery to be sent to Vendor for Repair as Non-Valuated (Material Type "UNBW") (Do not extend Accounting and Costing views since you don't require postings of Stock value and consumption values, you only want to track the Service/Repair Charges). It's not necessary to have materials as Non-Valuated always, it depends on your requirement.
    2. MIGO - Goods Receipt > Others (Receive the quantities of these materials using Movement Type 501 / 511) - Only if Stock of Material is not available.
    3. ME21N - Create Subcontracting PO (Here Main Material and Component will be same material)
    4. MB1B - Transfer Posting w.r.t. Subcon PO (Mvmt Type - 541, Spare Part stock will get posted to Vendor Stock)
    5. MB90 - Take Print out of this Material Doc as Returnable Gate Pass (U need to configure Message Determination of Inventory Mgmt)
    6. MIGO - GR against Subcon PO (101 - Receive Spare Part, 543 O - Consumption of Spare Part form Vendor Stock)
    7. MIRO - LIV for Service Charges w.r.t. Subcon PO

  • Photosmart Prem-Web C309n-s - How do I reattach parts in tray housing?

    In trying to fix a printer problem, I removed the main paper tray.  When I tried to reseat it, a plastic guide (~2" long) and a related metal torsion clip/spring (~2" long) became unattached from the opening into which the main paper tray is inserted.  How do I reinstall these parts (can't find a diagram of how they fit together in side of the tray housing)?

    I need help too!....This part just came off. How important is this part in relation to the pick up rollers? I am having a problem with these rollers not picking up and message code 0x61011beb is on display.
    Help, someone.....please.

  • How to receive a keyboard event (arrowkeys)

    Hi,
    I'm a bit confused about how to setup event-handling for keyboard event. I have created a window with a File's Owner called "MyDocument". But if I implement the method
    <pre>
    -(void)sendEvent: (NSEvent *)theEvent {
    printf("Called\n");
    </pre>
    it wont be called. Does anyone know what else I have to do in order to receive keyboard events when a user presses an arrowkey inside my application ?
    Macbook Pro 15''   Mac OS X (10.4.8)   2GHz, 2GB

    You most likely need to implement -(void)keyDown:(NSEvent *)event to catch keyboard events and then query event for the key pressed. This method is defined in NSResponder together with mouseDown:, mouseDragged, keyUp:, etc.
    Here's a couple of examples from two sample apps:
    'Dicey' (online sample code):
    <pre>
    -(void)keyDown:(NSEvent *)event {
    // If the space bar was pressed, toggle hold on the first responder
    if ([[event characters] isEqualToString:@" "]) {
    [[dice objectAtIndex:firstResponderIndex] toggleHold];
    [self setNeedsDisplay:YES];
    } else {
    // We do care about our superclass dealing with tab shift-tab for first responder changes
    [super keyDown: event];
    </pre>
    'Worm' (From: /Developer/Examples/AppKit/Worm):
    <pre>
    - (void)keyDown:(NSEvent *)event {
    NSString *keys = [event charactersIgnoringModifiers];
    wormHeading = kGameHeadingStraight;
    if (keys && [keys length] > 0) {
    unichar c = [keys characterAtIndex:0];
    if (c == NSLeftArrowFunctionKey) {
    wormHeading = kGameHeadingLeft;
    } else if (c == NSRightArrowFunctionKey) {
    wormHeading = kGameHeadingRight;
    </pre>
    Note the use of NSLeftArrowFunctionKey for example in Worm. These and many other 'special' key constants are defined in NSEvent.

Maybe you are looking for

  • HP 8600 all in one stopped printing on MACbook pro with OS 10.7.5

    My printer was working fine for the first couple of months and now I have to turn it off and on to get it to print. It has perfect connection to the internet as does my computer. Have rebooted the Wi-Fi etc.  That only lasts about a day at best.  I h

  • Impact of tax procedure

    Dear All, In the Indian context TAXINJ and TAXINN tax proceudres are used. Now suppose a customer has activated TAXINJ tax procedure. After some years the customer wants to change the tax procedure to TAXINN. [Vice-versa also] I would like to know th

  • Color the row based on condition

    Hello all, I am woring on an interactive adobe form being called by a web dynpro application. The adobe form interface used is XML Schema based. The form displays some data at header level and item level. The item details are displayed in a table. No

  • Embedding an xspf player into a swf

    well it looke easy enough, adn nowi running in circles... i'm got a version of dynamic xspf (flash) swf player. i'm trying to add music to a site... i can get the player to play fine on its own.. http://www.creativenet.net/dev/novastar/xspf_player_sl

  • Elements 10 and resizing canvas

    When resizing the canvas for a photo in some but not all saved images the canvas extension color is greyed out. The particular photo is saved as a Tiff. Why is this and how can I solve the problem Thanks