CURSOR%NOTFOUND vs no more records to process;

how can I differentiate between the above ? I have a cursor that selects data based on a condtion. If the condition is not met and I get CURSOR%NOTFOUND is true I want to handle this in one way while still being able to handle no more rows to process.
hope my question is clear
thanks
Message was edited by:
aanton

That means, if cursor%rowcount > 0 then you have found at least one record. If there was no record found at all, cursor%rowcount is 0.
SQL> get t
  1  declare
  2    cursor c1 is select dummy from dual where 1 = 1;
  3    cursor c2 is select dummy from dual where 1 = 0;
  4    l_res  varchar2(10);
  5  begin
  6    open c1;
  7    fetch c1 into l_res;
  8    if c1%notfound then dbms_output.put_line ( 'c1: not found, c1%rowcount: ' || c1%rowcount );
  9    else                dbms_output.put_line ( 'c1: found,     c1%rowcount: ' || c1%rowcount );
10    end if;
11    fetch c1 into l_res;
12    if c1%notfound then dbms_output.put_line ( 'c1: not found, c1%rowcount: ' || c1%rowcount );
13    else                dbms_output.put_line ( 'c1: found,     c1%rowcount: ' || c1%rowcount );
14    end if;
15    close c1;
16    open c2;
17    fetch c2 into l_res;
18    if c2%notfound then dbms_output.put_line ( 'c2: not found, c2%rowcount: ' || c2%rowcount );
19    else                dbms_output.put_line ( 'c2: found,     c2%rowcount: ' || c2%rowcount );
20    end if;
21    close c2;
22* end;
SQL> /
c1: found,     c1%rowcount: 1
c1: not found, c1%rowcount: 1
c2: not found, c2%rowcount: 0
PL/SQL procedure successfully completed.
SQL>

Similar Messages

  • What's status of my order?  We need more time to process your order.

    I cannot find on the Adobe site where to find the status of an order.
    Last Saturday I placed an online order for an annual subscription to the CC Photography package.  After I had completed all the steps a message was displayed on my browser that read something like "We need more time to process your order."  There was also a statement that said something to the effect that I would be contacted by email the next business day, but I have seen nothing.
    I'm certain this is not the place for questions about order status, but when I followed the steps in Contact Us, this is where I wound up.  I prefer to use email or the internal messaging system rather than phone, so I can have a record of what was said.
    Thanks - Dave

    This has been a colossal hassle.  Notice there's no reply to my question here about how to contact whoever the rep res referring me to.
    When you go through the order process it doesn't ask how your name appears on the credit card.  I'm "Dave" here, but on my credit card I'm David.  Maybe that's why it didn't go through.  Maybe it isn't wise to order on the weekends (I placed my order on a Saturday).
    In two chat sessions the rep said he (or she) would escalate the case and I'd hear in 24-48 hours.    Never heard a thing.
    I finally went through the order process on a Friday, edited my profile with my real name and it went right through.  I chose to download Photoshop CC 2014.  I got a Web page with the header Downloading now... or something like that.  But there was no activity indicator.  I tired the forum but the entire forum was down.  Finally after a useless chat I opted to start the download again.  The CC Application Manager started up and displayed a progress bar.  When it was finished I got a message saying the download had failed.  After a couple more tries I got PS and Bridge downloaded successfully then downloaded Lightroom.  BTW, you don't get the install files.  It installs as it downloads.  You can't tell it where you want it installed.  For us with a tiny boot SSD it's a squeeze.
    I've reactivated my Lynda.com membership and am catching up on what's new in PS CC 2013 and 2014.  Photoshop CC seems to be behaving OK, but I'm not sure if Adobe is ready for prime time.  Do you suppose they had a hand in crafting Healthcare.gov?. 
    - Dave

  • Hi all ........i want to append some more records to the already released

    HI all,
      How  to append some more records to the already released
    scheduled job .how to do this.

    HI
    process that job once again
    because its already completed means the previous records will update but if want to update some more then execute that job once again

  • Difference of fetching data, into a cursor variable and into a record?

    whats the difference of fetching data via cursor, into a cursor variable and into a record.
    i feel infact fetching data into cursor variable is more better, and plus lesser lines to code??

    Can you explain what you mean, preferably with an example? Generally, you fetch data from a cursor, not into one. I'm assuming by "fetching into a record" you mean inserting into a table?
    Justin

  • More records in Purchasing Cube than in PSA.

    Dear Folks,
    Right now i'm working on 0PUR_C01 Cube.In Quality server, i checked the data in Cube after executing the DTP and found that records are getting increased.Records in PSA(2152),but in Cube(2359),there are some routines in the Transformation checked them too they are ok.Transformation has 2 rule groups.And interestng thing is that we had the KF ZDCOUNT with rule type constant(1), and i found that for some records count=0.
    appreciate your quick reply.
    Regards,
    Rams.

    Hi
    As you have small no of records, run the DTP in Debud mode ( simulation mode) and check why you are getting 0 values from count key figure.
    If you have any end or Expert routine, you may get more records in target than source.
    Regards,
    Venkatesh

  • Reading long text for more records at a time

    Hi all,
    We have a requirement for which that data like textid textname textobject  and language  must  be taken in to an internal table and for each record in the internal table i  have to read the long text inorder to compare the long text for the given search text.
    If i use Read_text inside the loop and endloop it works but it may not be appropriate in performance point of view.
    Is there any function module which can read long texts for more records at a time.
    The long text data in STXL will be in raw data format right? is there any way to convert raw data to normal so that by hitting the STXL i can read the long text data for more than one record at a time.
    Thanks in advance
    sanju.

    HI Sanju,
    Below is a code snippet which describes reading a long text frm the screen and appending it into the internal table.This code is actually to read the text from the screen and inserting a record into STXl and STXH.
    From your query what i understood is that you are storing the long text from the screen into a internal table and so you not want to use the read_text FM due to performance issue.
    Since tdline(tline table) is 132 char long format i use this small logic to read the screen data and append it to my internal table.
    *Data Declarations
      DATA: lv_strlen TYPE i,
            lv_create TYPE boolean,
            lv_desc TYPE string.
      DATA: ls_text TYPE tline,
            ls_basic_text TYPE stxh.
      DATA: lt_text TYPE ztty_tline_tab.
      CONSTANTS:
       lc_tdid TYPE  thead-tdid VALUE 'Z001',
       lc_tdobject TYPE thead-tdobject VALUE 'Z_ALERTS'.
    *Appending the text to the internal table.
      lv_strlen = STRLEN( iv_alert_text-alert_text ).
      lv_desc = iv_alert_text-alert_text.
      IF lv_strlen < 132.
        ls_text-tdformat = '*'.
        ls_text-tdline = lv_desc.
        APPEND ls_text TO lt_text.
      ELSE.
    *logic to wrap text
        DO.
          ls_text-tdformat = '*'.
          IF STRLEN( lv_desc ) < 132.
            ls_text-tdformat = '*'.
            ls_text-tdline = lv_desc.
            APPEND ls_text TO lt_text.
            EXIT.
          ENDIF.
          IF lv_desc+132(1) <> ' '.
            CONCATENATE lv_desc(131) '-' INTO ls_text-tdline.
            lv_desc = lv_desc+131.
          ELSE.
            ls_text-tdformat = '*'.
            ls_text-tdline = lv_desc(132).
            lv_desc = lv_desc+132.
          ENDIF.
          APPEND ls_text TO lt_text.
        ENDDO.
      ENDIF.
    Please award graciously if found helpful.Please do ask me if i have not answered you properly.
    Thank you.
    Message was edited by:
            P M Harish

  • Screens missing when the Recording is processed : XK01

    I need to upload vendor master data. I also need to capture second address under the International Versions section. I could record it ( selecting the checkbox "Not a Batch Input Session") in the very first screen of SHDB.
    Otherwise we will not be able to see the actual screens in ME11.
    Problem:
    When the recording is processed, the International versions screen is not displayed and the process stops in the very first screen itself. It is not proceeded further.THe recording shows that everything is captured perfect.
    Can anybody give me the solution for this.This is very critical.
    SAP Version : 4.7
    Regards,
    Siva

    Hi Siva
    Try checking the Central Address Mgmt check box in the first screen while taking a recording. Or, if you think it is an issue with authorizations, try recording with an MM (functional) user id.
    If you find this answer useful, please reward me for the same.
    Good luck
    Karthik Potharaju

  • Problems with retrieving data from tables with 240 and more records

    Hi,
    I've been connecting to Oracle 11g Server (not sure exact version) using Oracle 10.1.0 Client and O10 Oracle 10g driver. Everything was ok.
    I installed Oracle 11.2.0 Client and I started to have problems with retrieving data from tables.
    First I used the same connection string, driver and so on (O10 Oracle 10g) then I tried ORA Oracle but with no luck. The result is like this:
    I'm able to connect to database. I'm able to retrieve data but from small tables (e.g. with 110 records it works perfectly using both O10 and ORA drivers). When I try to retrieve data from tables with like 240 and more records retrieval simply hangs (nothing happens at all - no error, no timeout). Application seems to hang forever.
    I'm using Powerbuilder to connect to Database (either PB10.5 using O10 driver or PB12 using ORA driver). I used DBTrace, so I see that query hangs on the first FETCH.
    So for the retrievals that hang I have something like:
    (3260008): BIND SELECT OUTPUT BUFFER (DataWindow):(DBI_SELBIND) (0.186 MS / 18978.709 MS)
    (3260008): ,len=160,type=DECIMAL,pbt=4,dbt=0,ct=0,prec=0,scale=0
    (3260008): ,len=160,type=DECIMAL,pbt=4,dbt=0,ct=0,prec=0,scale=1
    (3260008): ,len=160,type=DECIMAL,pbt=4,dbt=0,ct=0,prec=0,scale=0
    (3260008): EXECUTE:(DBI_DW_EXECUTE) (192.982 MS / 19171.691 MS)
    (3260008): FETCH NEXT:(DBI_FETCHNEXT)
    and this is the last line,
    while for retrievals that end, I have FETCH producing time, data in buffer and moving to the next Fetch until all data is retrieved
    On the side note, I have no problems with retrieving data either by SQL Developer or DbVisualizer.
    Problems started when I installed 11.2.0 Client. Even if I want to use 10.0.1 Client, the same problem occurs. So I guess something from 11.2.0 overrides 10.0.1 settings.
    I will appreciate any comments/hints/help.
    Thank you very much.

    pgoel wrote:
    I've been connecting to Oracle 11g Server (not sure exact version) using Oracle 10.1.0 Client and O10 Oracle 10g driver. Everything was ok.Earlier (before installing new stuff) did you ever try retrieving data from big tables (like 240 and more records), if yes, was it working?Yes, with Oracle 10g client (before installing 11g) I was able to retrieve any data, either it was 10k+ records or 100 records. Installing 11g client changed something that even using old 10g client (which I still have installed) fails to work. The same problem occur no matter I'm using 10g or 11g client now. Powerbuilder hangs on retrieving tables with more than like 240 records.
    Thanks.

  • Intercompany Elimination - No records to process

    Hi,
    I am working on Intercompany Elimination. I have two entities BP01_Input & BP02 under the entity BP01.
    BP01_Input has ICCost of 1200 against BP02.
    BP02 has ICSales of 1500 against BP01_Input.
    I carried out the following steps:
    1.     Changes to the Account dimension u2013 Added the ELIMACC property and filled it with ICDiff for the accounts ICCost and ICSales
    2.     Changes in INTCO dimension u2013 Added BP01_input and BP02 in entity property for Intercompany idu2019s I_BP01 and I_BP02
    3.     Changes in Entity Dimension u2013 Added ELIM property  and filled with u201CYu201D for BP01 and "N" for its subsidiaries
    4.     Changes in RptCurrency dimension u2013 USD is the reporting currency
    5.     Ran the data manager package for IC elimination  for running  the default ICELIM logic with parameters for Category (Actual) and Time (2008.Dec)
    The data manager runs successfully. But the log shows "No records to process".Elimination of 300 is not shown in ICDiff account.
    Please let me know if there are any mistakes or any other configuration steps required.
    Thank you.
    Regards,
    Shoba

    Hi John, txs for answering.
    Let me set a quick example:
    Entity hierarchy:
    500
      100
      200
      300
    700
      800
      9000
    Entity Account Month Year    DataSrc       Flow     Amount
    100     ABC      005     2012  DS_INPUT  F_100     9000
    I want the elimination intercompany (which runs through automatic adjustments) to create this record:
    Entity Account Month Year    DataSrc       Flow     Amount
    100     ABC      005     2012  DS_ELIM  F_100      -9000
    I dont need to save this elimination record at parent level, just for 100 Entity.
    This works, but I d like to know if it is valid or not.
    PD: I m on BPC NW 7.5 SP11
    Regards
    JAV

  • More than one process bind() to a multicast port.

    Hi,
    I found one strange behavior when there are more than one process bind() to the same multicast port. The problem is as the following:
    If there is a process bind to a port, say 2000 and joined a multicast group. This process did not do a SO_REUSEADDR,
    before bind() and join the multicast group. Later on, I have another program in the same host joining the same multicast group with the same port number (with SO_REUSEADDR), the second process will not be able to receive any data from the multicast group (with the same port number) eventhough the second process can join the multicast group successfully.
    However, if both process call setsockop with SO_REUSEADDR, both process can receive multicast data from the multicast group. The simplest fix is to have both set SO_REUSEADDR. But the problem is, the first application is an off-the-shelf software and we do not have source code to it.
    I wonder if this is a problem with Solaris. Any thoughts?
    Thanks,
    Shao

    Hi,
    I found the answer to this question. Basically, according to the source code (Solaris 8 Foundation Source), ip6.c, line #2510, multicast data is forwarded to all "listeners" only if the first "binder" has a SO_REUSEADDR set. What that mean is, if the first "binder" does not set SO_REUSEADDR before bind(), any subsequent bind() with SO_REUSEADDR is meaningless (in practical terms).
    My question is, is this behavior correct? I think it's much better to allow subsequent listeners (successfully bind and joined the multicast group) to be able to receive data. The reason is that if the first binder does not set SO_REUSEADDR before bind() the port and joined the multicast group should not deny any "late comers" to join in and participate in the multicast group. "Fixing the code" is not always practical especially if one of the application is a third-party application. Or reject bind() if the first "binder" does not allow SO_REUSEADDR.
    Any comment?
    Regards,
    Shao

  • I have to keep my cursor moving in order for firefox to process.

    If I stop moving my cursor, firefox stops processing. There is a new icon beside the tab title, that is a circle with a dot that travels around the circle and then circle turns green and rotates. Both these will stop moving IF I have stopped moving my cursor/mouse. I dont' have this problem in explorer but I prefer firefox. This just started the second day after I upgraded to newest version. This happens on every page, even logging into email or facebook, I have to keep the cursor moving in order for firefox to process and progress to the next page.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    * https://support.mozilla.com/kb/Safe+Mode
    * [[Troubleshooting extensions and themes]]
    In Firefox 4 you can use one of these to start in <u>[[Safe mode]]</u>:
    * Help > Restart with Add-ons Disabled
    * Hold down the Shift key while double clicking the Firefox desktop shortcut (Windows)

  • How can I write cursor which tell me no record exists

    Hi Experts,
    I want to know how can I write a cursor which told me no record exists before opening and running the loop.
    So I want that if no record exist then I dont want to run loop and open the cursor.
    Example: cursor c1 is select empno from scott.emp where empno=10
    In procedure body, I want to check if there is no record against my cusor then I don't like to open it.
    Thanks

    Rizwan Ali Wahla wrote:
    I want to know how can I write a cursor which told me no record exists before opening and running the loop.
    So I want that if no record exist then I dont want to run loop and open the cursor.Not possible.
    Example: cursor c1 is select empno from scott.emp where empno=10Single row? No need for an explicit cursor. No need for a loop. It can be done using an implicit cursor. E.g.
    SQL> create or replace function GetEmployee( empID number ) return EMP%RowType is
      2          empRow EMP%RowType;
      3  begin
      4          select
      5                  e.* into empRow
      6          from    emp e
      7          where   e.empno = empID;
      8          return( empRow );
      9  exception when NO_DATA_FOUND then
    10          return( null );
    11  end;
    12  /
    Function created.
    SQL>
    SQL> declare
      2 
      3          procedure ProcessEmp( empID number ) is
      4                  empRow  EMP%RowType;
      5          begin
      6                  empRow := GetEmployee( empID );
      7 
      8                  if empRow.empno is null then
      9                          dbms_output.put_line( 'Employee '||empID||' does not exist.' );
    10                  else
    11                          dbms_output.put_line(
    12                                  'Employee '||empID||' is '||empRow.ename ||
    13                                  ' and employed as '||empRow.job
    14                          );
    15                  end if;
    16          end;
    17 
    18  begin
    19          ProcessEmp( 7900 );
    20          ProcessEmp( 7901 );
    21  end;
    22  /
    Employee 7900 is JAMES and employed as CLERK
    Employee 7901 does not exist.
    PL/SQL procedure successfully completed.
    SQL> All SQLs are cursors. Every single SQL passed to Oracle for parsing and execution is a cursor. So it does not make sense to use one SQL cursor for testing the existence of a specific row, and then another to return the row.
    That kind of logic is PL/SQL logic and a single SQL cursor need to be used.
    PS. Make sure that the SQL projection only includes the columns needed in PL/SQL. If the SQL is a pure exist row? check, then do not return any column and use a literal value as the projected column.
    Edited by: Billy Verreynne on Feb 16, 2012 5:55 AM

  • How to Query a Cursor and retrieve a selected records

    Hi,
    I'm using a ScrollableCursor for pagination and it is working fine. Now i want to filter that cursor to get a selected records So i need to Query a cursor. Is it possible to Query a Cursor using Oracle Toplink.
    looking an api i found
    cursor.setSelectionCriteriaClone(expression)
    method is this method useful to apply the expression(Query) to the cursor. If it is possible then please send me the sample code.
    Thanks

    You cannot filter a Cursor, you would need the execute a new query (you could base your new query on the cursor's query's secltionCriteria though).
    James : http://www.eclipselink.org

  • Unable to do GR more than the process order quantity

    When we try to do a GR against a process order (MIGO), and we use a quantity more than the process order, then the system is issuing an 'error' message.
    Say process order is for 37000L, confirmation is done for 39000L (COR6): works
    But when we try the MIGO or MB31, for the GR, then the system issues error as M7022: 'quantity exceeded by 2000L'.
    Checked: 1) OMCQ and the message  M7/ 022 is set as 'w', warning.
                   2) Also, the permissible batch size is 35000L  - 39700L
    Please advice.
    Thnx!

    Hi
    you need to have an overdelivery tolerance (i.e 10%) in the process order header - goods receipt tab.
    The tolerance should be maintained in the work scheduling view of the material. Then it is copied into the process order automatically.
    BR
    Eivind

  • Open cursor for PLSQL table of records

    Is it possible to open a cursor for all data in a PLSQL table of records?
    something like
    cursor c (p1 number) is select * from <plsqltab>
    where <plsqltab>.col = p1

    There is no such thing as a PL/SQL table. Yes, I know that many calls this structure in PL/SQL a table. And that is exactly where all this confusion stems from.. and trying to treat such a "table" as an Oracle table using SQL.
    The correct terms are dynamic array (indexed by integer) or dynamic associative array (indexed by varchar). And an array is nothing like a table ito RDBMS processing.
    Yes, you can run SQLs against arrays. But it is "expensive". Why? Because the data sits inside PL/SQL Engine. Not in the SQL Engine. The data is in a PL/SQL defined structure. Not a SQL defined structure.
    So.. the data needs to be shipped from the PL/SQL Engine to the SQL Engine and converted into a format that the SQL Engine can understand and use.
    Also, once shipped and converted the SQL structure is not indexed. Which means that the only option is a full table scan of that structure.
    So you need to ask yourself why do you want to use SQL against a PL/SQL array? As soon as you do that, you are saying "Hey, this PL/SQL table ain't good enough and I need to process it using SQL".
    So why then does that data sit inside a PL/SQL array and not in a SQL table?
    Oracle provides you with the ability to create temporary session tables. These can be indexed. SQL can be run against them without all the "expenses" that are associated with running SQL against a PL/SQL array.
    PL/SQL arrays is a great tool. But only when it is the right tool to use. When someone says he/she needs SQL to use this tool, then I question the choice of the tool. Make sure you use the right tool for the job.

Maybe you are looking for

  • Fields in Stored Procedure does not appear in Crystal reports 2008.

    hi, I am now using crystal reports 2008 evaluation copy for 30 days. I am trying to create a stored procedure with parameter, here is my sample Stored Procedure code; DELIMITER $$ DROP PROCEDURE IF EXISTS `puerto`.`SP_FindEmployees`$$ CREATE DEFINER=

  • Noise in Gallery photos on web

    I am new to Dreamweaver. I used Photoshop CS4 to make a web gallery, got it into Dreamweaver and onto my website. However...   there is grain (or artifacts) showing up on some of the photographs on my website. There is no grain showing in the Photosh

  • Like select the icon "italic type or bold" to compose text

    like select the icon "italic type or bold" to compose text

  • Fade tool use?

    I'm trying to fade something out, and am dragging the fade tool into the audio region, but nothing happens. Any thoughts? Thanks.

  • Migrate a List from SharePoint 2007 to SharePoint 2010

    There's a SharePoint List in the 2007 server having some 32 SiteColumns. None of the columns are of type LookUp i.e., there is no dependency of any column over any other Lists. I just need to copy it as it is to 2010 server. Only problem is that it h