How to determine the cursor record count before the "open cursor"?

Is it possible to determine the record count of an explicit cursor without running a count()? Say, my cursor definition is something like this,
CURSOR cur_vehicle
IS
SELECT os.order_id, os.order_item, vs.part_id
vs.part_num,
vs.iso_num,
vs.model_yr
vs.dealer_cde,
vs.cust_cde,
px.plant_cd
FROM parts_source vs,
orders_source os,
plant_tbl_crossref px
wHERE os.order_id = vs.order_id
AND vs.part_id = os.part_id
AND vs.plant_cde = px.plant_cde
ORDER BY os.order_id;
I want to log the count of records returned by the above cursor prior to the first fetch, without running a count(1) for the query in cursor select.
I know adding " Count(1) over(order by null) " in the cursor SELECT will bring it. But that does not help me log the record count to some log file or table before opening the cursor for processing.
To conclude, my objective is to update the record count of cursor in some table before processing

sarvan wrote:
Is it possible to determine the record count of an explicit cursor without running a count()?
..snipped..No. The only way to do it correctly is inside that select.
Each select is a consistent read. Which means that if this is done as 2 select statements, the 1st select can see a different version of the data than the 2nd select statement. does. So if you want a count and that to be consistent and on the same version of the data than the select, it has to be done as part of the select.
Also consider what a cursor is. It is not a result set of sorts that is created in memory upfront - with a convenient interface that tells you the size/number of rows of that result set.
A cursor is basically a program that reads database data as input and produce output. A fetch from a cursor is an instruction for this program to execute and output data.
There's no data set that is created by the cursor from which the count can be determined. The cursor program does have state variables - like +%RowCount+ that specifies how many rows the cursor has thus far output. And you need to run that cursor to the end (no more output) in order to determine the total number of rows output by the cursor.

Similar Messages

  • How to get a total record count before grouping?

    I need to group a report on a formula that does roughly the following:
    [record count] / ( [total record count] / 20 )
    What this acheives is to label each record with a number of 1 - 20 which I want to group on. Getting this figure is the easy part, what is not working is the fact that I cannot group from a formula that is calculated after grouping. I overcame a portion of this by using "Whilereadingrecords" (rather than "count", running totals, or while printing records) to acheive a record count.
    I can't figure out how to get a total record count done before grouping. Is there a way to do this with "WhileReadingRecords"?? Is this even possible?
    Thanks
    John

    Hi John, 
    The order of how Crystal does things dictates the order of which features you can use.  Crystal has a two pass method.  In the first pass it does things like passing the query, grouping, summarizing.  In the second pass it does formulas, formatting, etc. 
    Unfortunately Crystal does the Grouping before summarizing so what you want to do can't be done in Crystal.  The best way to get around this to either create a SQL Command or view/stored procedure that will do the summarizing for you.  Then in the report you can use it. 
    Hope this helps,
    Brian

  • How to get the total record count for the report

    Hi,
    How can I get count of the total records shown in the report. When we set the report attributes, we have an option "Set Pagination from X to Y of Z"
    Does anyone know how can I get the Z value from APEX variables.
    I know we can use that query and get the count but I just want to know how we can use APEX Variables effectively.
    Thanks in advance.

    You write a loop, something like this:
    Go_block('B1');
    If not form_success then
      Raise Form_Trigger_failure;
    End if;
    First_Record;
    If not form_success then
      Raise Form_Trigger_failure;
    End if;
    Loop
      If :system.record_status in('CHANGED','INSERT') then
        -- modify the record here--
      End if;
      Exit when :System.Last_Record = 'TRUE';
      Next_Record;
    End Loop;
    First_Record;But be very careful-- If your block can fetch a large number of rows, (over 100), this loop can take a long time, and you should not use this method. The loop will continue fetching more rows from the database until all rows satisfying the query are retrieved.

  • How long can the iPhone 3GS record video before the battery runs out?

    My father invested in an iPhone 3GS Tripod adapter for his tripod, for some conferences and lectures. He has a 16GB 3GS, which will record about 8.6 hours, according to another thread I've read about on here. But he doesn't really want to bring the USB/Adapter cable with him, and have to worry about finding a power outlet. Assuming his phone is on full charge, and bluetooth/wifi are shut off, and brightness is kept a bit dim (not too dim) - can anyone give me a round about answer of how long the it will record video before the battery dies? This function is today, so timing is critical. I will have him take the charger/usb with extension cable just in case. I'd appreciate anyones input

    Not sure if the battery will die before or after your done recording on the iPhone.But most sites are claiming that you can record up to 2GB per video.I just recorded a one minute clip,and it rounded off to about 34MB.So if you devide that,it rounds off to around an hour of recording video...But take that with a grain of salt,I'm not good with math lol

  • When recording voiceovers, I click the stop recording button at the end, but I can't figure out how to get rid of the "click" sound before I send off the recording!

    When recording voiceovers, I click the stop recording button at the end, but I can't figure out how to get rid of the "click" sound before I send off the recording!

    njordan wrote:
    I can't figure out how to get rid of the "click" sound before I send off the recording!
    drag the BottomRight edge of the region to the left, past the unwanted sound

  • HT4515 how do I set the number of rings before the caller goes to voice mail ?

    How do i set the number of rings before the coller goes to voice mail on my iphone?
    Thanks you.

    Determined by your carrier, so contact them.

  • HT204053 How to I get music I purchased before the iCloud was created to show up on my new authorized iPhone?  Right now I can only see the Apps I recently purchased on the actual phone but older music I purchased on my CPU using the same Apple ID doesn't

    How to I get music I purchased before the iCloud was created to show up on my new authorized iPhone?  Right now I can only see the Apps I recently purchased on the actual phone but older music I purchased on my CPU using the same Apple ID doesn't appear.

    Does any music show in the Purchased tab on the iTunes store app on your phone ? Music can't be re-downloaded in all countries, and even where it can be it will only appear whilst it remains in the store. Do you have your purchases on your computer and/or on a backup of your puchases so that you can sync them to your phone ?

  • How to take a value of the first record/occurrence and the last record?

    Hi experts
    Can anyone help me to tell me:
    How to make IP can take a value of the first record/occurrence and the last record in CSV file?
    I need to take the first and last to put StarTime of first record y StopTime of last record in the target file
    This is my Original CSV File
    20110820,220DNE0220,140.13 ,0.000 ,E01,0
    20110820,240FGC4280,103.80 ,0.000 ,E01,0
    20110821,220DNE0220,142.58 ,0.000 ,E01,0
    20110821,240FGC4280,88.70 ,0.000 ,E01,0
    20110822,220DNE0220,151.92 ,0.000 ,E01,0
    20110822,240FGC4280,91.47 ,0.000 ,E01,0
    Where:
    The firts field is date.
    I require it so my Target File
    20110820,20110822,140.13 ,0.000 ,E01,0
    20110820,20110822,103.80 ,0.000 ,E01,0
    20110820,20110822,142.58 ,0.000 ,E01,0
    20110820,20110822,88.70 ,0.000 ,E01,0
    20110820,20110822,151.92 ,0.000 ,E01,0
    20110820,20110822,91.47 ,0.000 ,E01,0
    Thaks..

    Hi lizcam,
    A. Use FCC at sender side, it will convert CSV to XML like this
    Input XML
    <documentName>
    <recordset>
    <record>
      <Time>20110820</Time>
      <ID>220DNE0220</ID>
      <Quan>140.13</Quan>
      <Volume>0.000</Volume>
      <Auc>E01</Auc>
      <No>0</No>
    </record>
    </recordset>
    </documentName>
    Create a target DT like this
    Output XML
    <recordset>
    <record>
      <StartTime>20110820</StartTime>
      <EndTime>20110822</EndTime>
      <Quan>140.13</Quan>
      <Volume>0.000</Volume>
      <Auc>E01</Auc>
      <No>0</No>
    </record>
    </recordset>
    In MM,
    1.Time -> CopyValue[0] -> StartTime
    2.Time -> below UDF -> EndTime
    3.Quan -> Quan
    4.Volume -> Volume
    5.Auc -> Auc
    6.No -> No
    UDF u2013 Execution type u2013 All values of Queue
    public void getLastTimeValue(String[] inputEndTime, ResultList result, Container container) throws StreamTransformationException{
    result.addValue(inputEndTime[inputEndTime.length-1]);
    B. At receiver use again FCC to convert XML to CSV.
    FYI. If you want to optimize more, you can use
    1.globalContainer concept OR
    2.u201CAttributes and Methodsu201D, declare are String. Store the EndTime using one UDF and write another UDF to retrieve it.
    Regards,
    Raghu_Vamsee

  • Updating my iPhone 5 software has shortened the number of rings before the answer phone kicks in, how do I extend the time delay?

    Updating my iPhone 5 software has shortened the number of rings before the answer phone kicks in, how do I extend the time delay?

    If the codes Tanzim mentioned don't work, just call your carrier and ask them to extend your time until voicemail picks up, to 30 seconds. They do this routinely.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How do I get a page count from the HP Photosmart 5514?

    How do I get a page count from the HP Photosmart 5514?

    Simple.  Access the printer web gui by typing in the printers IP address into your browsers address bar.  Select Tools/Usage reports.  Done.

  • I am 19 days from my contract needing to be renewed and I broke my screen.    How far in advance can you renew before the actual renew day?

    I am 19 days from my contract needing to be renewed and I broke my screen.    How far in advance can you renew before the actual renew day?

    Basically it is on the day your contract ends. However some Verizon wireless corporate store managers can over ride that and update possibly a week early. But its iffy.
    Now Verizon will let you upgrade to the Edge program but you have a broken device and they will prey on you since you are desperate for a device. Edge plan is paying full price over 20 months and paying taxes on it up front, you then after paying 60% of the device off can edge up to another device. Now if you pay 60% off at anytime after 30 days you can continue to trade them in for new as much as you want.
    Or you can wait it out get a new free device under contract or reduced cost device again under a 2 year contract.
    The edge plan is no contract.
    Good Luck

  • My phone is not working the way it did before the manditory iOS 7 update.

    My phone is not working the way it did before the manditory iOS 7 update.  It freezes, it lags, I get kicked out of my apps, my messages do not send half of the time, I can't view the pictures in my camera roll if I enlarge them, and the phone glitches randomly.  How can this be fixed or what do I need to do to get it replaced??

    The Basic Troubleshooting Steps are:
    Restart... Reset... Restore from Backup...  Restore as New...
    Restart / Reset   >  http://support.apple.com/kb/ht1430
    Restoring  >  http://support.apple.com/kb/HT1414
    If you try all these steps and you still have issues... Then a Visit to an Apple Store or AASP (Authorized Apple Service Provider) is the Next Step...
    Be sure to make an appointment first...

  • I need to obtain the size of file before the send to server

    Hello,
    I need to obtain the size in bytes the a internal table before the send to server, I use the DESCRIBE sentence but is not allowed me to obtain this value, that sentence I need to use.
    Thanks in advance,
    DL

    If you are on release 620, have a look at class CL_ABAP_MEMORY_UTILITES method GET_MEMORY_SIZE_OF_OBJECT. It will tell you how much memory is allocated and how much is actually used. Here is some sample code:
    TABLES: sflight.
    DATA: isflight TYPE TABLE OF sflight.
    SELECT-OPTIONS: carrid FOR sflight-carrid.
    SELECT * FROM sflight INTO TABLE isflight
            WHERE carrid IN carrid.
    DATA: size1 TYPE abap_msize,
          size2 TYPE abap_msize,
          size3 TYPE abap_msize,
          size4 TYPE abap_msize,
          flag1 TYPE char128,
          size5 TYPE abap_msize,
          size6 TYPE abap_msize,
          flag2 TYPE char128,
          flag3 TYPE char128.
    TRY.
      CALL METHOD cl_abap_memory_utilities=>get_memory_size_of_object
        EXPORTING
          object                     = isflight
        IMPORTING
          bound_size_alloc           = size1
          bound_size_used            = size2
          referenced_size_alloc      = size3
          referenced_size_used       = size4
          is_part_of_non_trivial_szk = flag1
          szk_size_alloc             = size5
          szk_size_used              = size6
          low_mem                    = flag2
          is_in_shared_memory        = flag3.
    ENDTRY.
    WRITE: / 'Size of Bound and Allocated Memory:', size1.
    WRITE: / 'Size of Bound and Used Memory:', size2.
    WRITE: / 'Size of Referenced and Allocated Memory:', size3.
    WRITE: / 'Size of Referenced and Used Memory:', size4.
    WRITE: / 'Strongly Connected Component of Object:', flag1.
    WRITE: / 'Size of Allocated Memory of SCC:', size5.
    WRITE: / 'Size of Used Memory of SCC:', size6.
    WRITE: / 'Flag, whether only bound_size_* are filled due to mem.short.:', flag2.
    WRITE: / 'Flag, whether ONJECT is in the shared memory:', flag3.
    If you aren't on 620 or don't need to be that precise, you might try the following:
    DESCRIBE TABLE isflight LINES size1.
    WRITE: / 'Number of Lines:', size1.
    DATA: wa_sflight LIKE LINE OF isflight.
    DESCRIBE FIELD wa_sflight LENGTH size2 IN BYTE MODE.
    WRITE: / 'Size of one Line:', size2.
    size3 = size1 * size2.
    WRITE: / 'Total Size:', size3.
    Please note that the addition IN BYTE MODE only works in 610 and higher. It isn't neccesary before that release. However it is important to get accurate resuls in an Unicode System.

  • The SharePoint Server Publishing Infrastructure feature must be activated at the site collection level before the Publishing feature can be activated.

    Hi All,
    I am trying to activate the Publishing feature for a SharePoint website using a custom Site Definition File. The problem I am getting
    is when I try to use the custom site template I get an error message:
    New-SPSite : The SharePoint Server Publishing Infrastructure feature must be activated at the site collection level before the Publishing feature can be activated.
    The custom
    Site Definition File snippet is show below:
    <?xml
    version="1.0"
    encoding="utf-8"?>
    <Project
    Title="SiteDefinition1"
    Revision="2"
    ListDir=""
    xmlns:ows="Microsoft
    SharePoint"
    xmlns="http://schemas.microsoft.com/sharepoint/">
      <NavBars>
      </NavBars>
      <Configurations>
        <Configuration
    ID="0"
    Name="SiteDefinitionDelegateControls2">
          <Lists/>
          <SiteFeatures>
            <!--Document
    Set-->     
            <Feature
    ID="{3bae86a2-776d-499d-9db8-fa4cdc7884f8}"
    Name="FeatureDefinition/15/3bae86a2-776d-499d-9db8-fa4cdc7884f8"
    />
            <!--Publishing
    Prerequisites-->     
            <Feature
    ID="{a392da98-270b-4e85-9769-04c0fde267aa}"
    Name="FeatureDefinition/15/a392da98-270b-4e85-9769-04c0fde267aa"
    />
          ...Other Site Features
          </SiteFeatures>
         <WebFeatures>
            <!--2
    Publishing Web-->
         <Feature
    ID="{94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb}"
    Name="FeatureDefinition/15/94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb"/>
         ... Other Web Features
          </WebFeatures>
          <Modules>
            <Module
    Name="DefaultBlank"
    />
          </Modules>
        </Configuration>
      </Configurations>
      <Modules>
        <Module
    Name="DefaultBlank"
    Url=""
    Path="">
          <File
    Url="default.aspx">
          </File>
        </Module>
      </Modules>
    </Project>
    I hope you can help
    Colin

    As the error says.  The Publishing Infrastructure feature must be activated at the Site Collection level where you are creating a new site PRIOR to turning on the Publishing feature.  So if you are trying to use this site definition to create a
    new Site Collection then its not going to work.  If you are trying to create a sub site then make sure that Publishing Infrastructure is enabled in the site collection before trying to create a sub site with this site definition.
    Internally Microsoft does this for the Publishing Portals using custom code.  Here's an article that discusses how to do it in SharePoint 2010.  
    http://msdn.microsoft.com/en-us/library/office/gg615465(v=office.14).aspx
    Compare what's in the article to one of the Publishing templates available out of the box in 2013 and you should be able to find the assembly that is used to load the Publishing features.
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • HT1222 I am trying like **** to download itunes 10.6.3 (64 bit - Windows 7) and I keep getting "the installer was interrupted before the requested operations for iTunes could be completed.  Your systems has not been modified."  I NEED HELP, PLEASE!

    I am trying like **** to download itunes 10.6.3 (64 bit - Windows 7) and I keep getting "the installer was interrupted before the requested operations for iTunes could be completed.  Your systems has not been modified."  I NEED HELP, PLEASE!

    I got it figured out myself... yaaaaay for me!

Maybe you are looking for

  • Error 0x80070005 with Windows Ap Certification Kit

    I am getting the following error: I went to http://go.microsoft.com/fwlink/?linkId=235160 as suggested, but could not find anything of 0x80070005.  I am wondering if anyone could shed some light on this. Hong

  • How to add new browser type in visual studio 2010 performance test?

    Hi All,        Currently we have various list of browsers in browser type drop down,Suppose if i want to add browsers like Internet Explorer 9 (or) 10,Firefox 33 (or) later version.How to add?

  • How do i get my downloaded movies on my ipad to my itunes on my mac?

    It's not working

  • [SOLVED] Can't build Grub

    Hey all, I'm trying to patch Grub so that it doesn't show the "Welcome to GRUB" message during startup. I have done as is explained here: http://lists.gnu.org/archive/html/grub- … 00176.html This is the diff file I came up with: --- main.c.orig 2012-

  • Graphics driver update

    I can't for the life of me figure out which update my graphics drivers need.  My adobe CC illustrator program keeps prompting me to update.  It is a custom driver so intel advised I look on the toshiba site. Computer model: satellite c55t-b5230window