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.

Similar Messages

  • Open and closed hand cursors

    I have a drag image application and I wanted to use the open and closed hand cursors to move the image about. It seems there is no easy way of accessing these in Java. After searching for cursor names etc.. I decided to hard code the cursors from the .gif image. Also I didn't want the .GIFs as files as this adds to loading problems so I ended up using arrays of pixels that took a little while to enter.
    I'm giving you the code if you ever need to use it as I typed it in and wouldn't want anyone else to have to do the same.
    int curWidth=32;
                   int curHeight=32;
                   int curCol;
                   Image img;
                   int x,y;
                   int closed_black[] = { 6,5,7,5,9,5,10,5,12,5,13,5,5,6,8,6,11,6,14,6,
                             15,6,5,7,14,7,16,7,6,8,16,8,5,9,6,9,16,9,4,10,
                             16,10,4,11,16,11,4,12,15,12,5,13,15,13,6,14,14,14,
                             7,15,14,15,7,16,14,16,0};
                   int closed_white[] = { 6,4,7,4,9,4,10,4,12,4,13,4,5,5,8,5,11,5,14,5,15,5,
                             4,6,6,6,7,6,9,6,10,6,12,6,13,6,16,6,4,7,15,7,17,7,
                             5,8,17,8,4,9,17,9,3,10,5,10,15,10,17,10,3,11,17,11,
                             3,12,16,12,4,13,16,13,5,14,15,14,6,15,15,15,6,16,
                             15,16,7,17,14,17,0};
                   int closed_whiteruns[] = {6,13,7,15,7,15,5,15,5,15,5,14,6,14,7,13,8,13,8,13,0};
                   int open_black[] = { 10,3,11,3,6,4,7,4,9,4,12,4,13,4,14,4,5,5,8,5,9,5,12,5,
                             15,5,5,6,8,6,9,6,12,6,15,6,17,6,6,7,9,7,12,7,15,7,16,7,18,7,
                             6,8,9,8,12,8,15,8,18,8,4,9,5,9,7,9,15,9,18,9,3,10,6,10,7,10,
                             18,10,3,11,7,11,17,11,4,12,17,12,5,13,17,13,5,14,16,14,6,15,
                             16,15,7,16,15,16,8,17,15,17,8,18,15,18,0};
                   int open_white[] = {10,2,11,2,6,3,7,3,9,3,12,3,13,3,5,4,8,4,10,4,11,4,15,4,
                             4,5,6,5,7,5,10,5,11,5,13,5,14,5,16,5,17,5,4,6,6,6,7,6,10,6,
                             11,6,13,6,14,6,16,6,18,6,5,7,7,7,8,7,10,7,11,7,13,7,14,7,17,7,
                             19,7,4,8,5,8,7,8,8,8,10,8,11,8,13,8,14,8,16,8,17,7,19,8,3,9,6,9,
                             16,9,17,9,19,9,2,10,4,10,5,10,19,10,2,11,18,11,3,12,18,12,4,13,
                             18,13,4,14,17,14,5,15,17,15,6,16,16,16,7,17,18,17,7,18,16,18,
                             8,19,15,19,0};
                   int open_whiteruns[] = {9,14,8,17,4,16,5,16,6,16,6,15,7,15,8,14,9,14,9,14,0};                    
                   int pix[] = new int[curWidth*curHeight];
                   for(y=0; y<=curHeight; y++) for(x=0; x<=curWidth; x++) pix[y+x]=0; // all points transparent
                   // black pixels
                   curCol=Color.black.getRGB();
                   int n=0;
                   while(closed_black[n]!=0)
                        pix[closed_black[n++]+closed_black[n++]*curWidth]=curCol;
                   // white pixels
                   curCol=Color.white.getRGB();
                   n=0;
                   while(closed_white[n]!=0)
                        pix[closed_white[n++]+closed_white[n++]*curWidth]=curCol;
                   // white pixel runs
                   n=0;
                   y=7;
                   while(closed_whiteruns[n]!=0) {
                        for(x=closed_whiteruns[n++];x<closed_whiteruns[n];x++)
                             pix[x+y*curWidth]=curCol;
                        n++; y++;
                   img = createImage(new MemoryImageSource(curWidth,curHeight,pix,0,curWidth));
                   closedhandCursor = Toolkit.getDefaultToolkit().createCustomCursor(img,new Point(5,5),"closedhand");
                   for(y=0; y<=curHeight; y++) for(x=0; x<=curWidth; x++) pix[y+x]=0; // all points transparent
                   // black pixels
                   curCol=Color.black.getRGB();
                   n=0;
                   while(open_black[n]!=0)
                        pix[open_black[n++]+open_black[n++]*curWidth]=curCol;
                   // white pixels
                   curCol=Color.white.getRGB();
                   n=0;
                   while(open_white[n]!=0)
                        pix[open_white[n++]+open_white[n++]*curWidth]=curCol;
                   // white pixel runs
                   n=0;
                   y=9;
                   while(open_whiteruns[n]!=0) {
                        for(x=open_whiteruns[n++];x<open_whiteruns[n];x++)
                             pix[x+y*curWidth]=curCol;
                        n++; y++;
                   img = createImage(new MemoryImageSource(curWidth,curHeight,pix,0,curWidth));
                   openhandCursor = Toolkit.getDefaultToolkit().createCustomCursor(img,new Point(5,5),"openhand");
                   setCursor(openhandCursor);you need to define openhandCursor and closedhandCursor with your other cursor definitions (I made them default to start with) and then just use setcursor as normal. There must be an easier way to do this!
    p.s. thanks to Martin Zvarik for the original code here: http://www.jguru.com/faq/view.jsp?EID=9958

    Hi,
    you can use the same query...Also check the new code after the select..
    SELECT BUKRS BELNR GJAHR <b>BSTAT</b>
    FROM BKPF
    INTO TABLE T_BKPF
    WHERE BUKRS = P_BUKRS
    AND BSTAT IN ( ' ' , 'A' ) " ' ' - Normal document, A - Parked doc
    AND BLART = P_BLART
    AND CPUDT IN SO_CPUDT " Selection screen input.
    IF NOT T_BKPF[] IS INITIAL.
    SELECT BUKRS BELNR GJAHR BUZEI EBELN AUGBL AUGBT
    INTO TABLE T_BSEG
    FOR ALL ENTRIES IN T_BKPF
    WHERE BUKRS = T_BKPF-BUKRS
    AND BELNR = T_BKPF-BELNR
    AND GJAHR = T_BKPF-GJAHR
    AND EBELN IN SO_EBELN " selection-screen input
    ENDIF.
    LOOP AT T_BKPF.
    Parked
      IF T_BKPF-BSTAT = 'A'.
        WRITE: / T_BKPF-BELNR , ' - Parked'.
    process the next record.
        CONTINUE.
      ENDIF.
    Check for Open / Closed.
      LOOP AT T_BSEG WHERE BELNR = T_BKPF-BELNR
                                   AND      BUKRS = T_BKPF-BUKRS
                                   AND      GJAHR = T_BKPF-GJAHR
                                   AND      AUGBL <> ' '.
        EXIT.
      ENDLOOP.
    If the return code is 0 then the document is cleared..
      IF sy-subrc = 0.
        WRITE: / T_BKPF-BELNR , ' - Closed'.
    Else the document is not cleared.
      ELSE.
        WRITE: / T_BKPF-BELNR , ' - Open'.
      ENDIF.
    ENDLOOP.
    Thanks,
    Naren

  • Opening and closing a cursor

    I have read that, the cursor in a for loop will be opened and closed automatically. Will that be the same in the case of the code given below, where we are declaring the cursor before the for loop ?
    -- Code
    create or replace procedure test
    as
    begin
    -- some statements
    -- begin of another block
    declare
    cursor v_cursor is Select * from Employee;
    begin
    for cur in v_cursor loop
    -- loop statements
    end loop;
    end;
    end test; -- end of procedure
    Thanks in advance ..

    for more information on cursor for loop follow the link
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/01_oview.htm#767

  • Finder doesn't stop opening and closing!

    Help!
    I was playing Sims 2 (an addiction) a few minutes ago, and I took some video captures. When I tried opening and viewing them on Quicktime, OS X started acting up. Finder won't stop opening and closing now, it opens and closes almost instantly. It all started happening when I tried opening Quicktime. I tried searching Apple.com, and the web for answers and I haven't had any luck. My system's specs are:
    Mac Mini 1.42Ghz
    1GB of RAM (recently installed)
    Mac OS X Tiger 10.4.7
    At the time the problem occured, I was running AIM, Sims 2, and Quicktime. This has never happened before. I tried Shutting Down and coming back again but it kept doing it. I removed the Sims 2 CD and shut down and after awhile turned it back on, still on going. Right now the computer went into Screen Saver mode and I can see the cursor blinking in and out...
    Please help this is really frustrating...
    Mac Mini 1.42Ghz   Mac OS X (10.4.7)   1GB Ram

    See if you can boot up in safe mode. To do so, restart and hold down the shift key until it boots. It will take longer to boot because it will be running a file system check while booting so be patient.
    If that helps try rebooting again the normal way.
    If the problem comes back when you boot the normal way then reboot in to safe mode again and then try deleting the finder preferences file. Instructions on how to do this are available here:
    http://www.thexlab.com/faqs/finder.html
    I would then do some basic maintenance on your Mac as outlined in the following FAQ, just to be on the safe side.
    http://www.thexlab.com/faqs/maintainingmacosx.html

  • MB5B Report table for Open and Closing stock on date wise

    Hi Frds,
    I am trying get values of Open and Closing stock on date wise form the Table MARD and MBEW -Material Valuation but it does not match with MB5B reports,
    Could anyone suggest correct table to fetch the values Open and Closing stock on date wise for MB5B reports.
    Thanks
    Mohan M

    Hi,
    Please check the below links...
    Query for Opening And  Closing Stock
    Inventory Opening and Closing Stock
    open stock and closing stock
    Kuber

  • Open and closed invoices

    hi experts,
    I have to capture the parked, open and closed invoices in a report in reference to vendor...
    I got the parked invoice condition from the table BSTAT either v or w.
    But i am not getting the idea how to capture the open and closed invoices...
    Some one suggested me to use the ITEMSET structure but i donno how to capture those values can anyone suggest me how to do it...?
    SIRI

    Hi,
    you can use the same query...Also check the new code after the select..
    SELECT BUKRS BELNR GJAHR <b>BSTAT</b>
    FROM BKPF
    INTO TABLE T_BKPF
    WHERE BUKRS = P_BUKRS
    AND BSTAT IN ( ' ' , 'A' ) " ' ' - Normal document, A - Parked doc
    AND BLART = P_BLART
    AND CPUDT IN SO_CPUDT " Selection screen input.
    IF NOT T_BKPF[] IS INITIAL.
    SELECT BUKRS BELNR GJAHR BUZEI EBELN AUGBL AUGBT
    INTO TABLE T_BSEG
    FOR ALL ENTRIES IN T_BKPF
    WHERE BUKRS = T_BKPF-BUKRS
    AND BELNR = T_BKPF-BELNR
    AND GJAHR = T_BKPF-GJAHR
    AND EBELN IN SO_EBELN " selection-screen input
    ENDIF.
    LOOP AT T_BKPF.
    Parked
      IF T_BKPF-BSTAT = 'A'.
        WRITE: / T_BKPF-BELNR , ' - Parked'.
    process the next record.
        CONTINUE.
      ENDIF.
    Check for Open / Closed.
      LOOP AT T_BSEG WHERE BELNR = T_BKPF-BELNR
                                   AND      BUKRS = T_BKPF-BUKRS
                                   AND      GJAHR = T_BKPF-GJAHR
                                   AND      AUGBL <> ' '.
        EXIT.
      ENDLOOP.
    If the return code is 0 then the document is cleared..
      IF sy-subrc = 0.
        WRITE: / T_BKPF-BELNR , ' - Closed'.
    Else the document is not cleared.
      ELSE.
        WRITE: / T_BKPF-BELNR , ' - Open'.
      ENDIF.
    ENDLOOP.
    Thanks,
    Naren

  • Open and closing balances std report

    Dear All,
    please suggest me open and closing balances std report and can i suggest my user below t.code for viewing open and closing balnces for India scenarion T.code:J3RFLVMOBVED
    Regards
    Gopal.S

    hi
    kindly chk MB5B it will fullfill your requirement
    regards
    praveen.k

  • Service Requests Open 5 days?/Service Requests Open and Closed Today

    Help!
    How would I determine service requests open greater then 5 days, I use the # of Open SR's but cannot seem to get a date to work.
    Also what is the best way to count the SR's open and closed on the same day?
    Thanks in advance.

    You need to include a TIMESTAMPDIFF function in your filter... something to the effect of
    TIMESTAMPDIFF(SQL_TSI_DAY,"Service Request"."Create Date",CURRENT_DATE) > 5
    Double check the column reference.
    Mike L

  • 7344 servo motion switching between open and closed loop operation

    I have a custom end-of-line test system presently using a 4-axis 7344 servo controller to perform various functional tests on small, brushed DC motors. The system is programmed in C/C++ and uses flex motion functions to control the motor during testing. Motors are coupled to external encoder feedback and third party PWM drives running in closed-loop torque mode from an analog command signal. The system uses all four motion axis channels on the 7344 board to independently and asynchronously test up to four production motors at a time.
    In closed-loop mode, the system runs without issue, satisfying the battery of testing protocols executed by this system. I now have a request to add additional test functionality to the system. This testing must be run in open loop mode. Specifically, I need to use my +/- 10v analog output command to my torque drive to send different DAC output levels to the connected motor.drive while monitoring response.
    I do not believe the flex motion library or 7344 controller includes functions to easily switch between open and closed loop mode without sending a new drive configuration. I am also under the impression that I cannot reconfigure one (or more) servo controller axis channels without disabling the entire drive. As my system runs each axis channel in an asynchronous manner, any requirement to shutdown all drives each time I change modes is an unworkable solution.
    I am open to all ideas that will allow asynchronous operation of my 4 motor testing stations. If the only solution is to add a second 7344 controller and mechanical relays to switch the drive and motor wiring between two separately configured servo channels, so be it. I just want to explore any available avenue before I place a price tag on this new system requirement.
    Bob

    Jochen,
    Thank you for the quick response. The 7344 board does an excellent job running my manufacturing motor assemblies through a custom end-of-line tester in closed loop mode. A portion of the performance history and test result couples the motor through a mechanical load and external shaft. The shaft is in contact with a linear encoder that closes my servo loop.
    My new manufacturing requirement is to also sample/document how the small DC motor behaves in open loop operation. Your solution is exactly what I need to perform the additional functional tests on the product I am manufacturing. I see no reason why this cannot work. I was originally concerned that I would need to reinitialize the 7344 board after changing axis configuration. Initialization is a global event and impacts all four channels on the 7344 board.
    Using flex_config_axis() to change axis configuration on a single channel without disturbing other potentially running axis channels will solve my concern. It will be several weeks before I can return to the manufacturing facility where the 7344-based testing machine is located. I will update this thread once I verify a successful result.
    Bob

  • Font usage in CS6 Premiere , Open and Closed quotes??

    Hello
    I am trying to use open and closed quotes in CS6 Premiere, without any success.
    Using a Mac 10.8.5.
    When I try the alt shft [ and the shift [ it only uses one side of the quote.
    Any suggestions?
    Is this a software, settings or OS issue?
    Thank you
    I am working on deadline....
    Brian

    One side?  I'm confused.  You mean want these?
    But you're only seeing this?

  • COPA reporting with open and closed projects

    Dear All,
    I am designing a COPA solution for an infrastructure providing company using project systems and posting to/settling out of projects on a monthly basis. Projects run for long periods and continually incurr costs and earn revenue untill they are closed. The requirement is to report by common characteristics (say customer group) and separately for open and closed projects. My issue is how to separate the line items of projects where status changed to closed (having posted with the status REL previously), from the open ones, without entering the projects individually in the selections screen.
    Any ideas will be greatly appreciated.
    Thanks,
    Maddy

    Dear Satya,
    http://help.sap.com/saphelp_erp2005/helpdata/en/75/ee0bbd55c811d189900000e8322d00/content.htm
    An item of a purchase requisition is only regarded as Closed if the requested order quantity has been included in a purchase order.
    You can also set an item to Closed manually. <b>This item will then not be taken into account by the materials planning and control system.</b>
    You can set the Closed indicator manually at the following points (it can later be cancelled if necessary):
    When changing a purchase requisition, on the item detail screen
    When creating a purchase order referencing a requisition, on the item detail screen of the PO
    You can still create purchase orders by referencing a requisition if this indicator has been set in the requisition concerned.
    The indicator can also be set in the case of automatic PO generation from purchase requisitions. On the initial screen of the requisition, you can specify that the requisition is to count as closed as soon as an associated purchase order has been generated, even if the complete quantity requested has not been ordered, for example (Set reqs. to "closed" indicator).
    Analyses of Purchase Requisitions:
    http://help.sap.com/saphelp_erp2005/helpdata/en/75/ee1fa755c811d189900000e8322d00/frameset.htm (visit section under Reporting in Purchasing)
    Hope this will help.
    Regards,
    Naveen.

  • How to open and closed posting period??

    Dear Gurus,
    Pls help me, how to open and closed posting period.when and how we used special period.
    Regrds
    Mahesh

    HI,
    Tcode is ob52
    here we generally provide the following details
    a/c type from a/c to a/c from period year to period year from period year to period
    +                                    1            2007   12         2007      13       2007   16
    + implies it applicable to all account types
    generally we can have maximum 4 special periods and total no of periods(normal+special) should not exceed 16
    generally we use special periods for year end adjustments like tax adjustments
    if it is useful assign me points

  • Reg: Open and Closed Activities in DTR

    Hello Guru's,
    I am confused with the Open and Closed Activities in DTR, What are the significance of these activities?
    And when does an Open Activity changes to Closed Activity?
    And why does an Empty Open Activity gets created?
    How does the Open Activities effect the Performance of the system?
    In NWDS what is the significance of the Public Part and the dcdef xml files?
    Please explain and if possible send the links to better understand these? I tried searching for info but with no luck.
    Appreciate the Help.
    Thanks & Regards,
    Pramod

    Dear Pramod,
    Activity in general can be considered as the wrapper of your changes.
    While working in NWDI, any modification that you perform on your source code must be associated with an Activity.
    Some Definitions:
    Client DTR: Represents the Local Track file system present on you local machine, where Checked-out a desired code from Server DTR
    Server DTR: Represents the Central Repository present on the server, where your source code is checked-in.
    Open Activities
    These are the activities that are not yet checked-in to Server-DTR, and they represent the Open Version.
    Exmple:
    1) Suppose you have made some modification in "File A" which is associated in Activity-1
    2) When you open the DTR Perspective in your Developer studio, you will be able to see all the changes that you have associated in the Activity-1, this DTR-perspective of your NWDS is also termed as Client-DTR.
    3) But, when you open the Server-DTR in DTR Web interface, you will not be able to see the same file structure that is present in your client DTR, it will not contain the changes that you have incorporated in Activity-1.
    4) The changes present in Activity-A are not available to any other developers, even if you try to use the same developer ID and load the same track, the activities are still said to be purely Local.
    Closed Activities
    These are the activities that are already Checked-in to Server-DTR and they represent Closed Version.
    Example:
    1) In the same example explained above assume that we now Check-in the Activity-1.
    2) Now, if you open the Server-DTR in DTR Web Interface, you will be able to see the same file structure that is present in your Client-DTR.
    3) Now the changes that were present in Activity-A are also available to other developers too.
    Open Activity and Performance
    1) Open Activities create a temporary entry point reference on the Server DTR you can serach for open activities in Secer DTR web interface, every single activity occupies space on your local machine. So it may affect the performance only if the activity count is very high.
    2) In the local file system, the meta data is stored in the .dcdef file in the _comp
    subfolder.
    3) The meta data is stored in the .dcdef file, every public part has its own meta data file. They are located in the def subfolder of the component and have the fileextension pp.
    Every component (DC) is defined by a set of files, stored and versioned together with the
    component in the repository.
    u2022 A file with the reserved name .dcdef stores the basic attributes such as name,
    description and component type, the parent component (if there is one), a list
    of child components (if there are any), a list of dependencies, links to the component
    sources, and the access control list. The .dcdef file must be stored directly
    in the _comp folder.
    u2022 The folder _comp/def contains one file for each public part of the component,
    which carries the name of the public part with the extension .pp. This file contains a list
    of the development objects belonging to the public part and an access control list for
    this public part.
    Both .dcdef and .pp files are stored in an XML-based format; you can display them in the
    content display of the Repository Browser or with any text editor. However, this is
    not necessary. To create and edit these files, use the component tools of the SAP NetWeaver
    Developer Studio.
    In exceptions, you can manually repair the .dcdef or a .pp file of a component.
    Note that direct manipulations are dangerous and can render a component
    unusable.
    I hope you will get a clear picture now.
    Regards,
    Shreyas Pandya

  • Open and Closed Time Outside of the 15 Minute Options

    I have a 13 agent Call Center with one CSQ with Skills based  routing.
    The Call Center closes at 8 pm on Weekdays and 12  pm on Saturday EST. The time of day function only allows me to choose 15 min  increments for open and closed.  So the Call Center either closes at 8 pm or 7:45 pm.   I need to prevent calls from being queued after 7:58 pm on Weekdays and 11:58 am  on Saturday.  I don’t know how to get around this 15 min restriction.  A friend  of mine told me that some kind of Java query can be entered into a Boolean  variable and then use If / Then statements to check the time and route the call  to closed at 7:58 pm and 11:58 am.  Any help will be appreciated.

    Most commonly used backup methods

  • Customer/Vendor A/C with line item details and with opening and closing Bal

    Dear Sir / Madam,
    Is it possible to have a customer and / or vendor Sub-Ledger account-
    with line item details and with opening and closing balance detail
    for a particular period.?
    Regards
    Chirag Shah
    I thank for the given below thread which has solved the same problem for G/L Account
    Re: Report to get the ledger printout with opening balances

    Hello Srinujalleda,
    Thanks for your precious time.
    I tried the referred T-Code
    But this report is not showing Opening balance, closing balance detail.
    It only gives transactions during the specified posting period and total of it.
    Please guide me further in case if I need to give proper input at selection screen or elsewhere.
    Client Requires Report in a fashion
    Opening Balance as on Date
    + / -  Transactions during the period
    = Closing Balance as on date
    As that of appearing for G/L Account by S_ALR_87012311
    Thanks once again & Regards
    Chirag Shah

Maybe you are looking for