PreparedStatement and open cursors

Hi,
i write an application where it is necessary to get a lot of preparedStatements in one connection. The preparedStatements are used
only once and they are closed after the usage. But it seems to me that this close
has no effect. Depending on the value in open cursors the error ORA - 01000 raises and it is not possible to get another preparedStatement without closing and opening the connection. But that increases the runtime to much and the application is a performance-critical application.
Does anyone have an idea how to solve the problem?
Thanks

>
Any thoughts what could be the problem. Only time I ever got them was because the result set, statement, connection wasn't being closed or wasn't being closed in the correct order.

Similar Messages

  • Dynamic query and Open Cursor fetch into ??

    Hi;
    I think we took the wrong turn some were... because looks like a dead end...
    What I need to do:
    Create a procedure to compare two generic tables in diferente databases and find rows that have diferent data.
    (No restritions on what tables it might compare)
    What I have done:
    CREATE OR REPLACE PROCEDURE COMPARE_TABLES_CONTENT_V3(
    tableName_A IN VARCHAR2, tableName_B IN VARCHAR2, filter IN VARCHAR2) AS
    -- Get all collumns present in [TableName_A]
    -- This is necessary to create a dynamic query
    select column_name bulk collect
    into v_cols1
    from all_tab_columns
    where table_name = v_tab1
    and owner = nvl(v_own1, user)
    order by column_id;
    -- If there is no columns in table A ... them no need to proceed
    if v_cols1.count = 0 then
    dbms_output.put_line('[Error] reading table ' || tableName_A ||
    ' collumns information. Exit...');
    return;
    end if;
    -- Collect Collumns information by ',' separated, for the query
    for i in 1 .. v_cols1.count loop
    compareCollumns := compareCollumns || ',' || v_cols1(i);
    end loop;
    -- Create the query that gives the diferences....
    getDiffQuery := 'select ' || compareCollumns ||
    ' , count(src1) CNT1, count(src2) CNT2 from (select a.*, 1 src1, to_number(null) src2 FROM ' ||
    tableName_A ||
    ' a union all select b.*, to_number(null) src1, 2 src2 from ' ||
    tableName_B || ' b) group by ' || compareCollumns ||
    ' having count(src1) <> count(src2)';
    Whats the problem?
    I'm lost...I can access the query using debugging on the oracle procedure... and run it OK on a new SQL window. No problem here... its perfect.
    But I dont know how to access this information inside the procedure, I need to format the information a bit...
    I try a cursor...
    open vCursor for getDiffQuery;
    fetch vCursor into ??????? -- Into what... query, columns and tables is all dynamic...
    close vCursor;
    Any ideas..

    Making the issue more simple....
    At this point I have a oracle procedure that generates a dynamic sql query, based on the table names passed by parameter.
    getDiffQuery := 'select ' || compareCollumns || (.....)
    end procedure;
    This ''getDiffQuery'' contains a query that gets the diferences in the tables. (Working fine)
    I would like to access this information in the same procedure.
    I cant use cursor because the table, columns... actualy all is dynamic based on the generated query:( !

  • Open and closed cursor

    I have some doubts/questions .
    What is the difference between open and closed cursor?
    Are library cache locks same as parse locks?
    What is the difference between latch and mutex?
    I would be grateful if experts could answer these questions.
    Regards

    Almost correct. The terminology is however nor correct.
    Simplistically:
    The SQL engine receives a SQL. It attempts a soft parse first. This means looking for an existing cursor in the Shared Pool with the same SQL. This existing cursor can be in use by other sessions. It does not matter - if that cursor is in used (opend by other sessions), or not. It may not be in use at all and simply sitting there in the cache. If such a cursor is found, it is used for that session's SQL - and that session gets a cursor handle (reference/pointer) to that existing cursor.
    If the SQL engine does not find an existing cursor to use, it needs to create a brand new cursor in the Shared Pool. This is a hard parse. Again, the session receives a cursor handle for that new cursor created.
    And that is it.
    You now need to decide how to use that cursor handle. The cursor itself is a program. You have a handle to execute that cursor program. Via its bind interface you can input data to this cursor program. Then execute it and receive (fetch) output of that cursor program.
    So the ideal is to re-use the cursor handle again and again.
    Basic example: the following is not optimal as the same cursor is opened and closed, opened and closed, for each read from the file. A lot of soft parsing results.
    while not-eof( filehandle )   // read data from a file
      read file data into var1, var2
      open cursor for 'insert into testtab values( :1, :2)'   // create a cursor
      bind cursor :1 = var, :2 = var2  // bind values to cursor (for insert)
      exec cursor // do SQL insert
      close cursor 
    end whileThis is a lot better. A single cursor is used and executed again and again:
    open cursor for 'insert into testtab values( :1, :2)'   // create a cursor
    while not-eof( filehandle )   // read data from a file
      read file data into var1, var2
      bind cursor :1 = var, :2 = var2  // bind values to cursor (for insert)
      exec cursor // do SQL insert
    end while
    close cursor  In this case a single soft/hard parse - and the client uses that cursor handle to execute that cursor (insert data) program again and again.

  • Oracle and "Maximum open cursors exceeded"

    Hi,
    I am using Weblogic 7.0sp2 with Oracle 9.2.0. Since we are using manual JTA
    transactions and the 9.2 drivers are buggy in that respect, we are using the
    9.0.1 thin drivers delivered with weblogic.
    The problem I have is that after a while, we get the now classic "Maximum open
    cursors exceeded" error on connections from our connection pool (used through
    a
    TX datasource). I have of course checked all our JDBC code and it is fine. We
    do not leave any statement/connection open. In fact, I am certain that the
    problem is not caused by our applicative code.
    The reason I am so positive is that the numbers of open (cached) cursors is
    growing, even though there is no activity on our application (I mean no
    activity at all). The number of cursors is regurlarly increasing by one
    every 5 minutes until it reaches the maximum allowed for a session.
    I have listed the statements corresponding to the opened cursors (they
    do not belong to our code, as you might have guessed):
    SELECT sysdate, user from dual
    select longdbcs from javasnm$ where short = :1
    select longname from javasnm$ where short = :1
    As you can see, there are only three different statements. You can get
    the statements from the system view v$open_cursor for a given session
    but it will only give one row per different statement. If you want to know
    the # of opened cursors in your cursor, use v$sesstat with statistic# = 3
    (opened cursor current).
    I suspect something is wrong in the connection testing done by weblogic
    for the pool (I have activated test on reserved connections and test table
    name is "dual") that leaves a resultset/statement behind. What is weird
    though is that the refresh period is still 0 (not 5 minutes as you would
    expect from the cursor growth rate...).
    I would not say that it is an Oracle bug (as stated in some BEA FAQ I read)
    since our application JDBC code does not exhibit the same problem. The
    problem appeared with recent version of WebLogic for which the session
    cursor cache is enabled, I suppose for performance reasons - this
    is set by isssuing "ALTER SESSION SET SESSION_CACHED_CURSORS = ...".
    Talking about this, does anybody know to which value WebLogic sets this
    parameter when intializing the connection (this is neither
    documented/configurable)?
    Up to now, I have come up with possibly two workarounds, neither of which
    is satisfying:
    - resetting the pool from time to time
    - issuing "ALTER SESSION SET SESSION_CACHED_CURSORS = 0" when I get a
    connection from the pool. I have not tested this one personally (read
    in a newsgroup that someone else did successfully) but it is supposed
    to reset the cursor cache that is causing the trouble.
    Any help will be greatly appreciated,
    Regards,
    Thierry.

    Thierry Rouget wrote:
    Hi,
    I am using Weblogic 7.0sp2 with Oracle 9.2.0. Since we are using manual JTA
    transactions and the 9.2 drivers are buggy in that respect, we are using the
    9.0.1 thin drivers delivered with weblogic.
    The problem I have is that after a while, we get the now classic "Maximum open
    cursors exceeded" error on connections from our connection pool (used through
    a
    TX datasource). I have of course checked all our JDBC code and it is fine. We
    do not leave any statement/connection open. In fact, I am certain that the
    problem is not caused by our applicative code.
    The reason I am so positive is that the numbers of open (cached) cursors is
    growing, even though there is no activity on our application (I mean no
    activity at all). The number of cursors is regurlarly increasing by one
    every 5 minutes until it reaches the maximum allowed for a session.
    I have listed the statements corresponding to the opened cursors (they
    do not belong to our code, as you might have guessed):
    SELECT sysdate, user from dual
    select longdbcs from javasnm$ where short = :1
    select longname from javasnm$ where short = :1
    As you can see, there are only three different statements. You can get
    the statements from the system view v$open_cursor for a given session
    but it will only give one row per different statement. If you want to know
    the # of opened cursors in your cursor, use v$sesstat with statistic# = 3
    (opened cursor current).
    I suspect something is wrong in the connection testing done by weblogic
    for the pool (I have activated test on reserved connections and test table
    name is "dual") that leaves a resultset/statement behind. What is weird
    though is that the refresh period is still 0 (not 5 minutes as you would
    expect from the cursor growth rate...).
    I would not say that it is an Oracle bug (as stated in some BEA FAQ I read)
    since our application JDBC code does not exhibit the same problem. The
    problem appeared with recent version of WebLogic for which the session
    cursor cache is enabled, I suppose for performance reasons - this
    is set by isssuing "ALTER SESSION SET SESSION_CACHED_CURSORS = ...".
    Talking about this, does anybody know to which value WebLogic sets this
    parameter when intializing the connection (this is neither
    documented/configurable)?
    Up to now, I have come up with possibly two workarounds, neither of which
    is satisfying:
    - resetting the pool from time to time
    - issuing "ALTER SESSION SET SESSION_CACHED_CURSORS = 0" when I get a
    connection from the pool. I have not tested this one personally (read
    in a newsgroup that someone else did successfully) but it is supposed
    to reset the cursor cache that is causing the trouble.
    Any help will be greatly appreciated,
    Regards,
    Thierry.Hi. We don't make those queries either. I suspect they are internal to the
    oracle driver. One thing you can try is to set the size of the pool's
    statement cache to zero. Oracle will retain cursors for every statement we
    cache. The alternative is also to tell the DBMS to allow a given session
    more cursors.
    Joe

  • Open cursors and shared cached cursors

    Hi
    In addm report i found below recommendation, before any change in parameter i want to know about those parameters, is there any thumb rule for this parameters,
    is there any drawback if i increase those parameters.
    FINDING 7: 2.1% impact (10693 seconds)
    Soft parsing of SQL statements was consuming significant database time.
    RECOMMENDATION 1: Application Analysis, 2.1% benefit (10693 seconds)
    ACTION: Investigate application logic to keep open the frequently used
    cursors. Note that cursors are closed by both cursor close calls
    and
    session disconnects.
    RECOMMENDATION 2: DB Configuration, 2.1% benefit (10693 seconds)
    ACTION: Consider increasing the maximum number of open cursors a
    session
    can have by increasing the value of parameter "open_cursors".
    ACTION: Consider increasing the session cursor cache size by
    increasing
    the value of parameter "session_cached_cursors".
    RATIONALE: The value of parameter "open_cursors" was "300" during the
    analysis period.
    RATIONALE: The value of parameter "session_cached_cursors" was "20"
    during the analysis period.
    Thanks and Regards
    Jafar

    Jaffy
    Your system suffers from soft parsing (according to ADDM), therefore:
    - Increasing the value of open_cursors has no impact on soft parsing (only up to 9.2.0.4 open_cursors had a direct impact on that for PL/SQL programs).
    - Increasing the value of session_cached_cursors might help reducing soft parsing. If it helps or not is really dependent from the application.
    ADDM is probably advising to increase open_cursors as well, because the database engine will keep cursors open even if the application closes them.
    HTH
    Chris
    PS: cursor_sharing might be helpful to reduce hard parses. It has no impact on soft parses... So, forget the hint about it.

  • Can some body give me an advice, my cursor can not be controlled after I shut it down, and open again. But this problem goes away after I closed and opened the lid

    Can some body give me an advice, my cursor can not be controlled (using pad) after I shut it down, and open again. But this problem goes away after I close and open the lid.

    Boot from your OS installer disk and run Repair Disk from Disk Utility.

  • Opening and fetching cursor.. what accually happens?

    So, if we have an explicit cursor... we open it with open c_cursor_name... and fetches it into some variable...
    my question is - what really happens when we open cursor?
    does oracle make only instance of cursor object in memory? or... does it reads some basic data about rows that are going to be fetched (rowid's?)..? or what?
    also, if we make some insert into a table that is going to be rolled over by cursor (while cursor is fetching..), should cursor read this new data? for example, what is difference if cursor roll over an indexed ID and we make an insert with an ID=10, and cursor is currently on ID=100? or opposite? (commit included in insert)...
    oh, so many questions :)
    tnx :)

    Not really. The same SQL cursor in the shared pool applies.
    The difference is on the client side. Each of the methods you've listed is essentially using a different method on the client side to interact with the cursor on the server.
    Some methods are more desirable in some cases than another - there's not a single superior method. Each has pros and cons and addresses a specific set of client coding requirements.
    There are some preferred methods though on the client. The three primary ones are:
    a) use bind variables (enables one to re-use the same SQL cursor)
    b) re-use the same client cursor handle for tight loop operations
    c) use bulk binding
    The first one is kind of obvious - as bind variables creates a cursor "program" that can be called/executed with different values. Like an INSERT cursor for example. The same SQL cursor can be used to insert a million rows, with each execution using different variable values to insert.
    The second one is not that applicable to the PL language in PL/SQL - thanks to the integration between the PL and SQL languages. In other client languages though, you want to re-use not only the same server cursor, but the same client cursor handle. As this saves you a soft parse. So instead of this approach:
    // pseudo code
    for i in 1..count
      CreateCursor( c, <sql statement> );
      BindValue( c, 1, myVariable[i] );
      ExecCursor( c );
      CloseCursor( c );
    end loop;..the following is far more efficient:
    // pseudo code
    CreateCursor( c, <sql statement> );
    for i in 1..count
      BindValue( c, 1, myVariable[i] );
      ExecCursor( c );
    end loop;
    CloseCursor( c );This approach re-uses the client handle - which means a single db parse was needed. The prior approach required a brand new parse for each loop iteration. (even soft parsing is an overhead that should be avoided where possible)
    The last primary factor is bulk processing. This is fairly well documented for the PL language - the important bit to remember that bulk processing is only intended to pass more data with a single call between the PL and SQL engines. Nothing more. The price of which is a bigger PGA memory footprint. Thus there is a balance between how much data (rows/variables) one should pass between the two versus the amount of memory that consumes.

  • Maximum open cursors exceeded and cqj0 trace

    From this morning on the database is reporting the maximum open cursors exceeded in the cqj0 trace. When I see the alert log the error message appear again and again. I try to solve it by setting the open_cursor parameter but the problem do not disappear. I have an oracle rac database 11.1.0.7, OS is Suse Linux Enterprise 10. Also I have configured a local capture process in my database.
    Thank you.

    Hi,
    Please perfrom the following action plan
    1)sql> show parameter cursor_sharing
    2) generate the AWR report for the duration of 60min when you were getting the error and paste the contents of section
    sql ordered by version count
    Kind Regards,
    Rakesh jayappa

  • My Macbook Pro (OSX 10.6.7 2.26 GHz Intel Core 2 Duo) has started misbehaving on me. When I'm working, the cursor will start spontaneously moving to the left in a straight line, and randomly right clicking on things.  If I close the computer and open it b

    my Macbook Pro (OSX 10.6.7 2.26 GHz Intel Core 2 Duo) has started misbehaving on me. When I'm working, the cursor will start spontaneously moving to the in a straight line, and randomly right clicking on things.
    If I close the computer and open it back up, it sometimes stops for a little while, then will spontaneously start again. Any help would be truly appreciated. Thanks!

    See this knowledge base article. Also, you might want to update to 10.6.8 (don't know that that will fix your problem, but it's the latest version of Snow Leopard).
    Clinton

  • How to raise application error and preserve open cursor...

    Hello,
    I have to raise an application error under certain circumstances.
    In some cases there's an open cursor that has to be read by the calling application anyway because there are data that have to be read.
    In other cases the cursor does not have to be read.
    sample code:
    create or replace procedure get_address(
    pv_street varchar2,
    pv_number varchar2,
    pr_retid in out number,
    pr_refcurs in out get_streetpkg.t_refcurs )
    v_rowcount number;
    v_no_suiting_number boolean := false;
    begin
    delete temp_addr;
    -- get suiting rows
    insert into temp_addr
    select * from addr
    where street like pv_street
    and number like pv_number;
    v_rowcount := sql%rowcount;
    -- if no suiting row found then get all
    -- suiting streets regardless of number
    if v_rowcount = 0 then
    v_no_suiting_number := true;
    insert into temp_addr
    select * from addr
    where street like pv_street;
    end if;
    -- check whether data has been found
    select count(*)
    into v_rowcount
    from temp_addr;
    -- set return id if only one row is found.
    if v_rowcount = 1 then
    select id from temp_addr
    into pr_retid;
    end if;
    -- open cursor to provide data
    open pr_refcurs for
    select * from temp_addr;
    -- generate error - if no data found at all
    -- no data has to be read...
    if v_rowcount = 0 then
    raise_application_error( -20001, 'no data found' );
    end if;
    -- generate error - or better notification - message if no number found...
    -- SELECTED ROWS HAVE TO BE READ ANYWAY!!!
    if v_no_suiting_number then
    raise_application_error( -20002, 'streets found, but no suiting number' );
    end if;
    return;
    end;
    Prerequisites:
    - The calling application reads the open cursor and closes it.
    - The application cannot provide additional arguments and the stored proc cannot be converted into a stored func.
    - I cannot put the procedure into a package.
    - The application has to get information about success or failure (and reason of failure) through provided error numbers (-20999..-20000).
    Whenever the error is raised and pr_retid was set, retid is not set in the application, neither is the cursor.
    So what can I do to provide return ID and row data???
    Hope anyone can help me.
    Greetings, Heiko Kaschube
    null

    Sorry, I didn't read your list of pre-requisites carefully enough. Your problem is that prerequiste #4 (return Application Error number) is in flat contradiction with prerequisite #1 (calling application continues processing).
    To restate: RAISE_APPLICATION_ERROR means "the called program has encountered a problem so please cease processing and handle the error". Using RAISE_APPLICATION_ERROR prevents the calling program doing any more processing: control goes to the EXCEPTION handler. Therefore RAISE_APPLICATION_ERROR should only be used for abnormal processing conditions.
    I fail to see why you want to use RAISE_APPLICATION_ERROR to handle a situation which is quite obviously not an application error: your called program has found some data that you want to process.
    yours in puzzlement, APC

  • ORA-01000: maximum open cursors exceeded with Thin and OCI

    Hi I have this ERROR :
    ORA-01000: maximum open cursors exceeded
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at line 1
    and all the connections show this error, I run the weblogic.Admin RESET_POOL utility
    and the problem are fixed !!
    Why show this error ?
    why with RESET_POOL utility resolve the problem ?
    the Oracle Version is Oracle 8.1.7.0 32bits on Solaris 8

    Mitesh:
    I using testConnOnReserve=true and testReleasedConnections=true specify testTableName
    when the errors appear , but increse the open_cusror value to 1200, i think is
    not the solution, because the DB and Stored Procedure is used by Cold Fusion ,
    is the same Application, in Cold Fusion not show this error u other errors with
    380 users on the application.
    I check to increse the open_cusror and test the application.
    thanks
    Roberto
    Mitesh Patel <[email protected]> wrote:
    You should do couple of things here.
    First of all you can increse the open_cusror value to 1200 if it is ok
    with you.
    Secondly, make sure you are using testConnOnReserve=true and specify
    testTableNAme
    in your config.xml for your connection pool defination.
    Thanks,
    Mitesh
    Roberto Hernandez wrote:
    Mitesh Patel,
    WLS 6.1 sp3 on Solaris 8, in init.ora file
    session_cached_cursors = 30 and Open_Cursors = 600
    Any Idea to resolve the Error and not use manual RESET_POOL utility?
    thanks
    Mitesh Patel <[email protected]> wrote:
    This is know bug from oracle.
    XAResource.recover repeatedly returns the same set of in-doubt
    Xids irrespective of the input flag. According to the XA spec, the
    Transaction Manager should initially call XAResource.recover with
    TMSTARTRSCAN and then call XAResource.recover with
    TMNOFLAGS repeatedly until no Xids are returned. This Oracle
    bug could lead to infinite recursion and subsequent running out
    of Oracle cursors with error "ORA-01000: maximum open cursors
    exceeded."
    What version of weblogic are you using? What is value for max cursors
    in init.ora file
    in your dbserver?
    Resets the named database ConnectionPool by shutting down and
    reestablishing all the allocated connections. This method should
    only be called when the connection pool is known to be in a bad
    state, for example when the database has been restarted.
    By using Reset you are cleaning all bad connections and associated
    cursors
    with it. That
    is why it resolves ora-1000 for you.
    Mitesh
    Roberto Hernandez wrote:
    Hi I have this ERROR :
    ORA-01000: maximum open cursors exceeded
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at line 1
    and all the connections show this error, I run the weblogic.Admin
    RESET_POOL
    utility
    and the problem are fixed !!
    Why show this error ?
    why with RESET_POOL utility resolve the problem ?
    the Oracle Version is Oracle 8.1.7.0 32bits on Solaris 8

  • Why won't my trackpad work properly and the cursor will move on it's own and open windows and menu's randomly?

    I bought my Macbook Pro less than a year ago and the other night I was watching a TV show in itunes and I couldn't use the track pad. I was able to finally shut the Macbook down and the next morning I rebooted it. It was still acting weird and the trackpad was jumpy and would randomly start opening windows and menus as if someone was contriolling it remotely. I used my bluetooth mouse and it seemed to work ok until tonight when I was copying some files wirelessly (or trying to) and evey time I tried to select files the cursor would jump to another screen and open a menu and then select all and open all my file folders. I was able to get that to stop openin ght ewindows but I still can't use the track pad and the machine acts like it is possesed and has a mind of it's own. I have made sure file saring and screen sharing are off and the battery shows to be normal from doing the control+battery test. What is going on and how can I get this fixed?

    Look at this Apple support article and see if this is of any help:
    http://support.apple.com/kb/TS1449
    In addition, check the MBP battery which resides under your trackpad.  They have been known to swell up and interfere with the trackpad operation.
    Ciao.

  • Having issues with my MacBook. Even when the internet is disconnected, apps are still closing and opening on their own. I sometimes do not have control over my cursor.....any suggestions?

    Having issues with my MacBook. Even when the internet is disconnected, apps are still closing and opening on their own. I sometimes do not have control over my cursor.....any suggestions?

    There are several possible causes for this issue. Please take each of the following steps that you haven't already tried until it's resolved. Some may not be apply in your case.
    1. Follow the instructions in this support article, and also this one, if applicable. A damaged or defective AC adapter could be the cause, even if it's the right kind.
    2. Open the Bluetooth preference pane in System Preferences and delete all pointing devices other than the trackpad, if applicable. Disconnect any USB pointing devices. By a "pointing device," I mean a peripheral that moves the cursor, such as a trackpad, mouse, trackball, or graphics tablet. A plain keyboard is not a pointing device.
    3. Start up in safe mode and test, preferably without launching any third-party applications. If you don't have the problem in safe mode, but it comes back when you restart as usual, stop here and post your results. Do the same if you can't start in safe mode. If there was no difference in safe mode, go on to the next step.
    4. Reset the System Management Controller.
    5. If you're using a Bluetooth trackpad, investigate potential sources of interference, including USB 3 devices.
    6. A swollen battery in a portable computer can impinge on the trackpad from below and cause erratic behavior. If you have trouble clicking the trackpad, this is likely the reason. The battery must be replaced without delay.
    7. Press down all four corners of the trackpad at once and release. If there's any effect, it's likely to be temporary, and the unit needs to be serviced or replaced.
    8. There's a report that a (possibly defective) Thunderbolt Ethernet adapter can cause the built-in trackpad of a MacBook to  behave erratically. If you're using such an adapter, disconnect it and test.
    9. There's also a report of erratic cursor movements caused by an external display that was connected but not turned on.
    10. If none of the above applies, or if you have another reason to think that your computer is being remotely controlled, remove it from the network by turning off Wi-Fi (or your Wi-Fi access point), disconnecting from a Bluetooth network link, and unplugging the Ethernet cable or USB modem, whichever is applicable. If the cursor movements stop at once, you should suspect an intrusion.
    11. Make a "Genius" appointment at an Apple Store to have the machine and/or external trackpad tested.

  • VBPA and VBAK query using OPEN CURSOR... anyway to skip buffer?

    Hi all,
    I have a query which VBPA inner join VBAK. In this query, I am using VBPA-KUNNR and VBPA-PARVW to query out data. I know VBPA holds a lot of data and querying in this way will be very heavy.
    So I use OPEN CURSOR to query the SELECT .. INNER JOIN for these two tables...
    It's fast for partners with few sales document.
    But, i noticed the query will do a buffer before it process the query...
    So my question is, is there a way to by-pass the buffer so it can immediately query?
    Thanks,
    William Wilstroth

    Hi Sandeep,
    I did put the BYPASSIUNG BUFFER syntax in the query. The result is still the same...
    I wonder if it's just querying by VBPA-KUNNR and VBPA-PARVW is causing it? On the other hand, I think it's not because I am using VBPA-PARVW key field...
    Hmmm... I wonder why in the first time query, it will go to buffer and it takes out some time...
    Thanks,
    William Wilstroth

  • How to use open cursor and iner join in one statement

    Hello All,
    Could any one post the code for the below question?
    How to use open cursor and iner join in one statement
    Regards,
    Lisa

    OPEN CURSOR c FOR SELECT     carrid connid fldate bookid smoker
                        FROM     sbook innerjoin shook
                        ORDER BY carrid connid fldate smoker bookid.
    Pls reward if helpful.

Maybe you are looking for