How to lock a table when i insert a row

hi, friends,
how to lock a table when i insert a row, then unlock the table

If you want to lock the whole table so that no-one else can do DML then you go LOCK TABLE <table> IN EXCLUSIVE MODE. This lock remains in force until you commit or rollback.
There are less powerful locking modes available, but you can look those up in the OTN online documentation.
APC

Similar Messages

  • How to add multiple table when creating add on using b1de

    Hi all,
    Plz help me
    How to add multiple table when creating add on using b1de.
    Thanks

    Hi dns_sap,
    Can you explain a little better what you are trying to accomplish? Is it to create UserTables and UserFields in the database, when the addon runs the first time?
    If so, you can use the following code
    Add User Table
            Try
                Dim lRetCode As Long
                Dim oUDT As SAPbobsCOM.UserTablesMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables)
                oUDT.TableName = TableName
                oUDT.TableDescription = TableDescription
                oUDT.TableType = TableType
                lRetCode = oUDT.Add
                '// Check for error when adding the Table: if lRetCode = 0 the table was created; if lRetCode = -2035 the table already exisits
                If lRetCode <> 0 Then
                    oApplication.MessageBox("Error: " & lRetCode.ToString & ", " & oCompany.GetLastErrorDescription)
                End If
            Catch ex As Exception
                oApplication.MessageBox(oCompany.GetLastErrorDescription)
            Finally
                System.Runtime.InteropServices.Marshal.ReleaseComObject(oUDT)
                oUDT = Nothing
                lRetCode = Nothing
                GC.Collect()
            End Try
    Add User Field
    Try
                Dim lRetCode As Long
                Dim oUDF As SAPbobsCOM.UserFieldsMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)
                oUDF.TableName = TableName
                oUDF.Name = FieldName
                oUDF.Description = FieldDescription
                oUDF.Type = FieldType
                lRetCode = oUDF.Add
                '// Check for error when adding the field: if lRetCode = 0 the field was created; if lRetCode = -2035, the field already exists
                If lRetCode <> 0 Then
                    oApplication.MessageBox("Error: " & oCompany.GetLastErrorCode & ", " & oCompany.GetLastErrorDescription)
                End If
            Catch ex As Exception
                oApplication.MessageBox(oCompany.GetLastErrorDescription)
            Finally
                System.Runtime.InteropServices.Marshal.ReleaseComObject(oUDF)
                oUDF = Nothing
                lRetCode = Nothing
                GC.Collect()
            End Try
    Regards,
    Vítor Vieira

  • How to hide system tables when using the Oracle SQL Developer?

    Hi,
    I would like to know how can I show only the tables that I created under the Tables tree? I didnt find a way to create a separate database using the Oracle Sql Developer. I see all the tables together, and would like to differentiate between different databases.
    Can anyone explain to me how to do these things?
    Thanks,

    Hi,
    I would like to know how can I show only the tables that I created under the Tables tree? Your posting is not clear,again tell something more on tables tree,what u want to achieve with it.
    How to hide system tables when using the Oracle SQL Developer? if u connected with sys, system or user with dba role then u have a privilege to see these tables,so revoke the privilege/role from ur user to view this tables if ur connected other then sys,system,
    I didnt find a way to create a separate database using the Oracle Sql Developer. DBCA is a tool for creating the new database.
    Kuljeet

  • How can I use table headers only without using rows.

    how can I use table headers only, without using rows and without leaving the space.
    If anyone could say me how to paste the pic in this questions, I would have shown it.
    The flow of view is in this way
    {Table header(table on top of table)
    column header1___|| column header2__ || column header3__ ||}
    <b>Here is the blank space I am getting, How to avoid this space?this space is of one table row height</b>
    {Contents column1 || Contents column2 || Contents column3 || (This is of other table below the uper table)}
    I am using scroll for the content part of table only.
    So I am using two tables.
    I am using NW04.

    I did the possibles you explained, but couldn't get rid off the space.
    Any other solutions?
    I am keeping the header static and the content columns scrollable.
    I have used two tables one to display header above and the other to display only the contents.
    I have put the contents table in scroll container.
    And the header table in transperent container.
    Thanks and Regards,
    Hanif Kukkalli

  • How to lock a table

    Hi all,
    When I insert a record to a table , how to lock it for
    preventing others write the table at the same time?
    Thanks.

    If you want to use online documentation, go to
    http://tahiti.oracle.com
    and search for "lock table"

  • How to lock DB table

    Hello, I'm using EclipseLink 1.2 (I hope I've chosen right forum branch). I need to lock a DB table.
    I know there are some methods like lock(), refresh(), find() with LockModeType enum parameter. I know that I can lock all rows returned with a query if I use parameter LockModeType. But I need to lock table fully for insert, update and delete. Besides, I need to lock table not from object model only, but to lock it within DB.
    Now I'm executing pl/sql procedure in my method start:
    CREATE OR REPLACE PROCEDURE TEST_ME (N NUMBER) AS
    BEGIN
      LOCK TABLE some_table IN EXCLUSIVE MODE NOWAIT;
    END TEST_ME;
    /Is this the only way?

    Hello,
    I'm not sure I understand the reasoning why you want to lock the entire table, or what you mean when you say it needs to be locked within the database. Pessimistic locking though is generally not the prefered option so if what you are looking for is not available in LockModeType, then of course you can execute SQL or a stored procedure to get a lock directly. I do not know of any other ways to get what you describe - I would recommend avoiding pessmistic locking altogether if possible though.
    Best Regards,
    Chris

  • How to update the table when change list item in classic report

    hi ,
    i worked with apex 4.2 and i create normal classic report with one select list(named loved)Column ,now i want to update table when user change the list with new value ,i can't create dynamic action to do this,i create check box with primary key and loop for check item to update the table but i can't get the value of list item. and for more speed the user want to do this when change the list value.
    my question
    1- how to do this by javascript and get the value from list item and update the table with new value
    2- is i must use API to create list item so i can get the value of item in report or what.
    Thanks
    Ahmed

    I coded the following to give you direction:
    1. In the "Element Attributes" section of the DEPTNO column, I call a javascript function as:
    onchange = "javascript:updateTable(this);"2. I wrote a simple javascript function that shows an alert when the user changes the select list as:
    <script language="JavaScript" type="text/javascript">
    function updateTable(pThis)
        var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
        alert('Row# - '+ vRow + ' has the value - ' + pThis.value);
    </script>Now, you can call a AJAX on-demand process inside the javascript function to update the database value.

  • How to lock a table in a report program

    Hi all,
         I have a requirement inwhich if i have selected one radio button  the table should locked .
       and the i need to check wether the table is locked or not by checking the condition.if locked continue else i need to stop.
    can any one help me doing this.

    Hi,
    Hope this information will be useful for you.....
    The description of an SAP lock to a table is made via the lock condition and the lock mode.
    The lock condition is a logical condition for the lines of the table to be locked. It describes the area of the table which the lock is to protect from competitive access. To avoid the administration of the lock becoming complicated, the lock condition can not be formulated as freely as the WHERE clauses:  only fully qualified key fields related by AND may appear in the condition.
    Via the lock mode you define which operations on the table are to be protected by the lock. The lock modes available are:
    Read lock (shared lock)
    protects read access to an object. The read lock allows other transactions read access but not write access to the locked area of the table.
    Write lock (exclusive lock)
    protects write access to an object. The write lock allows other transactions neither read nor write access to the locked area of the table.
    Enhanced write lock (exclusive lock without cumulation)
    works like a write lock except that the enhanced write lock also protects from further accesses from the same transaction.
    In order to be able to define SAP locks for a table, you must first create a lock object for the table via Development->Dictionary.
    If the data for an application object is distributed among several database tables, it is often necessary to be able to lock these tables simultaneously. It is therefore possible to include several tables in a lock object, althought they must be related via appropriate foreign key relationships. The tables involved in a lock object are also known as its base tables.
    Thanks
    NITESH

  • How to LOCK a table in SAP?

    Hi,
    Just wondering is there a way we can lock a table in SAP?
    tcode or something?
    ex. there a tcode to lock tcodes (SM01)
    so wondering if there is a tcode or another method?
    Thanks!

    Hi,
    These are application locks not the database tables lock.
    If you use this function modules (enqeue and dequeue)
    then only it works the concept of locking.If you dont use this fms then you can directly access the table.
    If I am the developer and I dont implement the  locks then no locking concept would happen.
    Regards,
    Vamshi.

  • Split Oracle 11g Table Partition and Insert new rows

    Hi,
    I have a doubt that i would like to be clarified. I need to split a partition of a table with more than 800 Million records, but at the same time (during the split operation) i need to insert new records (not in the partition that is being splited). Is there any problem/risk doing this? Is the insert ETL process going to fail ?
    Thanks in advance
    Greetings.
    Nuno
    Edited by: user13512889 on 1/Set/2011 3:25

    Hi Enrique,
    Thanks for posting in MSDN.
    Based on the description, you want to modify the formula for the A1 and B1 cell when you insert a new rows.
    Yes, we can use Worksheet.Change to dermin the change of data on the worksheet then we can modify the formula as we wanted. Here is a sample for your reference:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Me.Range("A1").Formula = "=MAX($A2:$A" & Me.UsedRange.Rows.Count & ")"
    Me.Range("B1").Formula = "=MIN($B2:$B" & Me.UsedRange.Rows.Count & ")"
    End Sub
    You can more detail about Excel VBA developing from link below:
    Getting Started with VBA in Excel 2010
    Welcome to the Excel 2013 developer reference
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Table maint genertr inserting multiple rows with all fields editable

    Hi
    I have created a ztable in se11 and maintained table maintenance generator SM30.
    Now i need to insert multiple rows into the table with all fields editable.
    How can i achieve this?
    Thanks in advance.

    >
    deepak thimmegowda wrote:
    > Hi
    >
    > I have created a ztable in se11 and maintained table maintenance generator SM30.
    >
    > Now i need to insert multiple rows into the table with all fields editable.
    >
    > How can i achieve this?
    >
    > Thanks in advance.
    Create a Table maintenance generator with One Step .
    regards,
    Jinson.

  • How do I prevent tree collapse after insert of row?

    Hi,
    I've got a tree with several discrattrbindings. It's a recursive tree representing a parent/child relation.
    If I add a sub record to one of the children, the tree collapses. The insert is fine and the tree is ok, it's just that it completely collapses everytime I add something. How do I prevent this? This is extremely annoying for users.
    (jdev9031 on win2k)
    Greetings,
    Ivo

    I've got some additional info, which I think is a bug.
    After the first record is added, the tree is collapsed, as I've said above. Now, if I reopen the tree and then try to open a node (that was previously closed) which has no subitems, then at the moment I click the '+', the entire tree collapses again. If I open a node that contains subs, it's fine, but empty nodes cause the tree to collapse.
    This is only after insertion of a row. If I run the app without inserting a row, the tree remains open if I open an empty node.

  • How to export a table with half a million rows?

    I need to export a table that has 535,000 rows. I tried to export to Excel and it exported only 65,535 rows. I tried to export to a text file and it said it was using the clipboard (?) and 65,000 rows was the maximum. Surely there has to be a way to export
    the entire table. I've been able to import much bigger csv files than this, millions of rows.

    What version of Access are you using?  Are you attempting to copy and paste records or are you using Access' export functionality from the menu/ribbon?  I'm using Access 2010 and just exported a million record table to both a text file and to Excel
    (.xlsx format).  Excel 2003 (using .xls 97-2003 format) does have a limit of 65,536 rows but the later .xlsx format does not.
    -Bruce

  • How to update a table when exception?

    The form contains only 1 block, a control block, which will trigger a oracle report when user save it.
    It will insert a record into a table. If report generate successfully, it will update the status to completed and vice versa.
    How can I do so? Because in the exception block, it will rollback the record inserted and cannot update the status anymore.
    {color:#000000}Begin
    INSERT ..........
    Some Processing......
    Call Report.......
    UPDATE the status .......
    Exception
    When OTHERS THEN
    UPDATE the status .......
    End{color}
    Thanks.

    If there is only a control block, forms will not do any commit, so you have to put a commit; at the end of your procedure, both in the main and in exception blocks.
    You can then suppress the 'No changes to commit' message.
    Best practice approach would be to have a stored procedure coded as autonomous transaction.

  • How oracle locks child table with foreign keys?

    I have 3 tables. tab1 , tab2,tab3.
    tab2 has FK on tab1.
    tab3 has FK on tab2.All the FKs are indexed.
    One transaction in my code changes tab3.
    One transaction in my code changes tab1,tab2 and tab3.
    I am facing deadlock issues on tab3 when both transactions work concurrently.
    If I lock tab1 with "for update nowait " at the start of both transaction,will the problem be solved?

    Let me elaborate on my problem
    TAB1          
    =====          
    a1 b1 c1     
    a2 b2 c2     
    a3 b3 c3     
    TAB2               
    =====               
    x1 y1 z1 a1          
    x2 y2 z2 a2          
    x3 y3 z3 a3          
    (FK indexed)          
    TAB3
    =====
    p1 q1 r1 y1
    p2 q2 r2 y2
    p3 q3 r3 y3
    (FK indexed)
    Transaction 1 for session1
    select * from TAB1 where col1 = a1 for update nowait;
    doing activities on tab2 and tab3 depending on the foreign key joins in loop.
    Transaction 2 for session 2
    select * from TAB1 where col1 = a2 for update nowait;
    doing activities on tab2 and tab3 depending on the foreign key joins in loop.
    1) Please let me know whether these sessions can head towards deadlock.
    2) If some session try to update TAB3 row of y1 when session 1 is still working , how will system behave?
    will it go for blocked session or go for dead lock or get an exception message?
    Edited by: user9974355 on Dec 17, 2008 11:58 PM
    Edited by: user9974355 on Dec 18, 2008 12:00 AM

Maybe you are looking for

  • How to set front panel size to be same as one led?

    Hello All, LV2010 In documentation reads that minimum front panel size is one pixel. I need to create front panel which have same size as one led (see attachment). I'm not able to make front enough small just by dragging window borders. I also tried

  • HT1937 how to get a backup password which i have never made

    i tried all my password but non of them worked how do i get a password for the back up on itunes

  • Details for TDS

    Dear All Can any one help how we need are configuring TDS in SAP Business one, should we use addon or what if we are using Addon which add on we need to use Thanks and Regards Boopathi.T

  • Cust site ID and Cust Site Dyn

    Hi, Can some one please help me to understand the difference between Cust Site ID and Cust Site Dyn? where it is maintained and Can a sales order have both these? Tcode/ Tables? Please explain at a begginer level, as I am not a SD consultant. Regards

  • Download Button not working

    The Download button on the Download page just reloads the same Download page... How can I fix this?!