How To Lock Rows (in the DB)

I need to lock a Row when a users enters some editing JSP until the user finished doing changes, while the other users (using VOs. created on the fly, and SQLJ) **DO NOT** have to get access to that Row.
From a bean used in a JSP or in My AppModule How do I get a Lock over a Row? (The lock must be visible to all users of the D.B. not just the ones using the Framework.)
Also setting the Transaction locking mode to NONE and doing manually the locks doesn't seems to be locking anything to the rest of users of the Framework.
Thanks in advance.

Or else you could issue the following select statement:
select *
from tab1, tab2, ....
where <join clause>
for update of <table to be updated>

Similar Messages

  • How to get row of the selected cell  in ALV  while implementing OVS

    Dear Folks,
                    I am implementing OVS search help in ALV.When i click on cell, i can see the search help in  cell and now i can identify the colomn of the cell but i can't identify the row of the cell.Can any one tell me how to identify row of the cell in this case.
    Nirad.

    Thnx for the answer nithya.I have solved problem my self.
    DATA: elem_ovs TYPE REF TO if_wd_context_element,
            ls_data TYPE REF TO data,
            ls_index type string.
      FIELD-SYMBOLS : <ovs_data> TYPE data.
      elem_ovs = ovs_callback_object->context_element.
      ls_data = elem_ovs->get_static_attributes_ref( ).
      ls_index = elem_ovs->GET_INDEX( ).
    and this is the solution.

  • How to select rows in the inner JTable rendered in an outer JTable cell

    I have wrriten the following code for creating cell specific renderer - JTable rendered in a cell of a JTable.
    table=new JTable(data,columnNames)
    public TableCellRenderer getCellRenderer(int row, int column)
    if ((row == 0) && (column == 0))
    return new ColorRenderer();
    else if((row == 1) && (column == 0))
    return new ColorRenderer1();
    else
    return super.getCellRenderer(row, column);
    ColorRenderer and ColorRenderer1 are two inner classes, which implement TableCellRenderer to draw inner JTable on the outer JTable cell, having 2 rows and 1 column each.
    Now what is happening the above code keeps executing continously, that is the classes are being initialised continously, inner JTables are rendered (drawn) continously, and this makes the application slow after some time. It throws java.lang.OutOfMemoryException.
    WHY IS IT SO??? I can't understand where's the bug..
    Any advice please???
    Moreover i want selections in inner tables and not on outer table, how can this be possible.
    I am working on this since a long time but have not yet found a way out...

    With your help i have overcome the problem of continous repeatition.
    The major problem which I am facing is, in selecting rows in the inner rendered JTables.
    I have added listener on outer JTable which select rows on the outer JTable, hence the complete inner JTable which being treated as a row, gets selected.
    The thing is i need to select the rows of inner rendered JTables,not the outer JTable.
    How to go about it??
    I have even added listener to inner rendered JTables, but only first row of every table gets selected.
    Please help....
    Thanks in advance.

  • How to delete rows in the target table using interface

    hi guys,
    I have an Interface with source as src and target as tgt both has company_code column.In the Interface i need like if a record with company_code already exists we need to delete it and insert the new one from the src and if it is not availble we need to insert it.
    plz tell me how to achieve this?
    Regards,
    sai.

    gatha wrote:
    For this do we need to apply CDC?
    I am not clear on how to delete rows under target, Can you please share the steps to be followed.If you are able to track the deletes in your source data then you dont need CDC. If however you cant - then it might be an option.
    I'll give you an example from what im working on currently.
    We have an ODS, some 400+ tables. Some are needed 'Real-Time' so we are using CDC. Some are OK to be batch loaded overnight.
    CDC captures the Deletes no problem so the standard knowledge modules with a little tweaking for performance are doing the job fine, it handles deletes.
    The overnight batch process however cannot track a delete as its phyiscally gone by the time we run the scenarios, so we load all the insert/updates using a last modified date before we pull all the PK's from the source and delete them using a NOT EXISTS looking back at the collection (staging) table. We had to write our own KM for that.
    All im saying to the OP is that whilst you have Insert / Update flags to set on the target datastore to influence the API code, there is nothing stopping you extending this logic with the UD flags if you wish and writing your own routines with what to do with the deletes - It all depends on how efficient you can identify rows that have been deleted.

  • How to add rows in the multicolumn listbox

    hello all,
    the questions are as below:
    1. how to add the rows in the multicolumn listbox?
    2. the message is RS232 communication message with hex format, how to convert the 2D format to adapt the itemnames property?
    does anyboady can provide a simple example? thanks a lot.
    Solved!
    Go to Solution.

    Hello muks,
    I would like to come up with the function like below picture:
    the multicolumn listbox include 5 columns, the fifth column is hex format. I want to add the row one by one after each cycle, meanwhile there's a button that can clear the contents in the multicolumn listbox.
    So the challenge for me is how to concatenate the different format into one array. then how to insert the row one by one.
    Thanks in advance.

  • How to populate rows in the detail table of a form from another table.

    please can someone help me here:
    i have a master/detail page. the master data is created and then i would like to do this: when one goes to the detail page (when first created), i would like somehow to populate all the rows in the detail table from rows retrieved in another table (with conditions).
    i am new to apex so if this is a stupid question i apologise in advance!

    Hi
    Firstly, there are no stupid questions, we all start somewhere!
    However, I could do with some more detail (or even better an example on apex.oracle.com). Please can you post exactly what you have so far and what you want to achieve with simple details of the tables involved.
    It sound like you may need to create a custom process to populate the details. You say 'with conditions'... what conditions?
    Cheers
    Ben
    http://www.munkyben.wordpress.com
    Don't forget to mark replies helpful or correct ;)

  • How to insert row in the middle of a table so that the below content will move to another page?

    I'm making a huge form in LiveCycle Designer. I want to be able to add rows in the middle o the table but in a way that the content below will move down automatically in a way it doe's in Word for example.
    Sometimes I am adding a very high new row in the middle of a page and I want the content in the below rows to be moved to another page and if it is necessary I want a new page to be automatically created on the bottom of a document or something.
    Is this possible or do I have to move everything by hand if I add new row to a table?

    If you are adding the rows at the runtime by clicking a button, then you have to use the instance Manager to add rows.. It will add rows at the end and then you need to write code to move the row at the desired location by using the moveInstance method of the instanceManager.
    If you are adding a row at the design time, then you can right clcik the row and choose to add rows below.
    Thanks
    Srini

  • How to highlight rows in the following code.

    Hi,
      I am using the following logic to display 2 lists at a time.
    I want to highlight the last 2 rows of both the lists that I am displaying.how to do it.
    Kindly help.
    TYPE-POOLS : slis.
    TABLES : mara,
    makt.
    SELECT-OPTIONS : mat FOR mara-matnr.
    DATA : BEGIN OF itab OCCURS 0,
    matnr LIKE mara-matnr,
    maktx LIKE makt-maktx,
    matkl LIKE mara-matkl,
    mtart LIKE mara-mtart,
    END OF itab.
    DATA : BEGIN OF itab1 OCCURS 0,
    mtart LIKE mara-mtart,
    count TYPE i,
    END OF itab1.
    DATA : BEGIN OF itab1_col OCCURS 0,
    mtart LIKE mara-mtart,
    count TYPE i,
    END OF itab1_col.
    DATA : t_fcat1 TYPE slis_t_fieldcat_alv,
    t_fcat2 TYPE slis_t_fieldcat_alv,
    wa_fcat TYPE slis_fieldcat_alv,
    t_eve TYPE slis_t_event,
    wa_eve TYPE slis_alv_event,
    t_layout TYPE slis_layout_alv.
    DATA : v_repid LIKE sy-repid,
    t_mat LIKE mara-matnr.
    DEFINE create_fcat.
    clear wa_fcat.
    wa_fcat-fieldname = &1.
    wa_fcat-seltext_l = &2.
    wa_fcat-outputlen = &3.
    append wa_fcat to t_fcat1.
    END-OF-DEFINITION.
    START-OF-SELECTION.
    PERFORM get_data.
    PERFORM dis_data.
    *& Form get_data
    text
    FORM get_data.
    SELECT amatnr bmaktx amtart amatkl INTO CORRESPONDING FIELDS OF TABLE itab
    FROM mara AS a INNER JOIN makt AS b ON
    amatnr = bmatnr
    WHERE a~matnr IN mat.
    LOOP AT itab.
    itab1-mtart = itab-mtart.
    itab1-count = 1.
    APPEND itab1.
    ENDLOOP.
    SORT itab1 BY mtart.
    LOOP AT itab1.
    MOVE-CORRESPONDING itab1 TO itab1_col.
    COLLECT itab1_col.
    ENDLOOP.
    ENDFORM. "get_data
    *& Form dis_data
    text
    FORM dis_data.
    v_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
    EXPORTING
    i_callback_program = v_repid.
    REFRESH t_fcat1.
    CLEAR t_fcat1.
    REFRESH t_eve.
    wa_eve-name = 'TOP_OF_PAGE'.
    wa_eve-form = 'TOP_OF_PAGE1'.
    APPEND wa_eve TO t_eve.
    create_fcat:
    'MATNR' 'Material' '10',
    'MAKTX' 'Material Description' '40',
    'MTART' 'Type' '10',
    'MATKL' 'Group' '10'.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
    EXPORTING
    is_layout = t_layout
    it_fieldcat = t_fcat1
    i_tabname = 'ITAB'
    it_events = t_eve
    TABLES
    t_outtab = itab.
    REFRESH t_fcat1.
    CLEAR t_fcat1.
    REFRESH t_eve.
    wa_eve-name = 'TOP_OF_PAGE'.
    wa_eve-form = 'TOP_OF_PAGE2'.
    APPEND wa_eve TO t_eve.
    create_fcat:
    'MTART' 'Type' '10',
    'COUNT' 'Total' '5'.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
    EXPORTING
    is_layout = t_layout
    it_fieldcat = t_fcat1
    i_tabname = 'ITAB1_COL'
    it_events = t_eve
    TABLES
    t_outtab = itab1_col.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
    ENDFORM. "dis_data
    *& Form top_of_page1
    text
    FORM top_of_page1.
    FORMAT COLOR COL_POSITIVE.
    WRITE:/ 'First Block'.
    FORMAT COLOR OFF.
    ENDFORM. "top_of_page
    *& Form top_of_page2
    text
    FORM top_of_page2.
    FORMAT COLOR COL_NEGATIVE.
    WRITE /5 'Second Block'.
    FORMAT COLOR OFF.
    ENDFORM. "top_of_page

    Hi Renu,
    U Can use this FORM
    FORM TOP_OF_PAGE.
      FORMAT FRAMES ON INTENSIFIED ON COLOR = 7.
      WRITE : / 'SOURCE SYSTEM INFORMATION'.
      FORMAT FRAMES OFF INTENSIFIED OFF COLOR OFF.
      FORMAT FRAMES ON INTENSIFIED ON COLOR = 2.
      WRITE : / 'User Name  : ', sy-uname.
      WRITE : / 'System ID  : ', sy-sysid.
      WRITE : / 'Client     : ', sy-mandt.
      WRITE : / 'System Date: ', sy-datum.
      WRITE : / 'System Time: ', sy-uzeit.
      FORMAT FRAMES OFF INTENSIFIED OFF COLOR OFF.
    ENDFORM. "TOP_OF_PAGE
    U can make changes accordingly
    Rohit G

  • How to lock Mail on the Dock

    For reasons I don't really understand I have a hard time keeping the Apple Mail on the dock. I did hte righ-click option and check "Keep in Dock"  and that did not work.  I am useing OS X 10.8.3 on an iMac.  My wife has the same issue with her Outlook icon on a MBP.
    How can I lock the Mail icon to stay on the Dock?

    Download the free app TinkerTool from http://www.bresink.com/osx/TinkerTool.html
    In the TinkerTool preferences, go to "Dock" and (in "Restricted Dock") check "Don't allow to modify content."
    Then click on Relaunch Dock.
    Thereafter, if you ever want to make any modifications to the Dock, you will need to uncheck "Don't allow to modify content."

  • How to lock portions of the screen

    I'm new to Contribute, having just downloaded a trial
    version. The software seems geared toward the user who will be
    making modifications to websites, not an administrator. How do you,
    as an administrator/site designer, lock certain portions of the
    screen so that users can't fiddle with them? Does this only work
    with Dreamweaver templates?
    The sites I design do NOT live on a server of mine. Each
    customer finds their own host, so I cannot control access that way.
    I also build very basic, barebones sites using tables and
    external style sheets, and do all of my HTML coding from scratch. I
    do not use Dreamweaver or any other WYSIWYG HTML packages, so I
    don't work with templates. Can such locks be implemented using my
    style of site design?
    Thanks for any info. I searched the Adobe site but couldn't
    find an answer.

    You could try faking a Dreamweaver template by copying DW
    template tags (i.e. HTML comments) into your source pages. But DW
    is a great page and site building tool and you can always try a
    trial version of it.

  • How to Delete rows in the database table by using Table Control

    Hi Experts,
    I wrote one program.
    In that program i used table control.
    I displayed data from database table in the table control, but i want to delete selected rows.
    Can anybody please tell me this by writing sample code
    thank you
    Basu

    Hi ,
    Pls try this coding below or check the prg demo  - RSDEMO02 in se38
    WHEN 'DELL'.
    * remove marked lines
          LOOP AT IT_SPFLI WHERE MARKED = 'X'.
            DELETE IT_SPFLI.
          ENDLOOP.
          IF SY-SUBRC <> 0.
            GET CURSOR FIELD FLD LINE LINNO OFFSET OFF.
            SET CURSOR FIELD FLD LINE LINNO OFFSET OFF.
            IF FLD CP 'IT_SPFLI*' AND SY-SUBRC = 0.
              LINNO = LINNO + TC_SPFLI-TOP_LINE - 1.
              DELETE IT_SPFLI INDEX LINNO.
              TC_SPFLI-LINES = TC_SPFLI-LINES - 1.
            ENDIF.
          ENDIF.
    or another eg :
    MODULE USER_COMMAND_0100 INPUT.
        SAVE_CODE = OK_CODE.
        CLEAR OK_CODE.
        CASE SAVE_CODE.
    WHEN 'DELE'.
                CALL FUNCTION 'COPO_POPUP_TO_GOON'
                    EXPORTING
                         TEXTLINE1 = 'Selected rows will be deleted!'
                         TEXTLINE2 = 'Are you sure?'
                         TITEL     = 'Delete rows'
                    IMPORTING
                         answer    = confirmation.
                IF CONFIRMATION = 'G'.
                    REFRESH ITAB_PHONELIST.
                    CLEAR ITAB_PHONELIST.
                ENDIF.
    MODULE EXTRACT_USERDATA INPUT.
        CASE SAVE_CODE.
            WHEN 'DELE'.
                IF SELECTION IS INITIAL AND
                   confirmation = 'G'.
                     CLEAR ITAB_PHONELIST.
        ITAB_PHONELIST-NAME = RECORD-NAME.
        ITAB_PHONELIST-PHONE = RECORD-PHONE.
        ITAB_PHONELIST-EMAIL = RECORD-EMAIL.
        APPEND ITAB_PHONELIST.
    <b>Reward pts if found usefull :)</b>
    regards
    Sathish

  • How to delete rows in the SQL Server table based on the contents of Excel file

    Hello, everyone,
    I have an Excel file which contains data for certain dates. I need to load it in a SQL Server table. But before doing that, I need to check if the table already contains data for the dates in the Excel file. If it does, I need to delete those data
    first. Not sure what is the best and efficient way to do this. Your help and guidance would be much appreciated.
    Thank you in advance.

    there are multiple ways of doing this
    Fastest method would be below
    1. Have a data flow task using excel source. Then add a OLEDB destination to dump the data to a staging table
    2. Have a Execute sql task to delete data from your actual table based on staging table data. The query would look like
    DELETE t
    FROM YourTable t
    WHERE EXISTS (SELECT 1
    FROM StagingTable
    WHERE DateField = t.DateField)
    3. Have another execute sql task to do final insert like
    INSERT YourTable (Col1,Col2,...)
    SELECT Col1,Col2,..
    FROM StagingTable
    the above operations will be set based and faster
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to Convert Rows of the Columns in Multiple Columns

    Hi,
    I have Data in one of the table of Oracle Application.
    Sample Data.....
    Period_Start_date Period_Type Demand
    09-22-2005 1 5
    09-21-2005 1 10
    09-20-2005 1 5
    09-19-2005 1 2
    09-18-2005 1 20
    09-17-2005 1 19
    09-16-2005 1 3
    Output Required.
    Period 6 Period 5 Period 4 Period 3 Period 2 Period 1 Current
    3 19 20 2 5 10 5
    This need to be Done in Using SQL Statement.
    On the base of Current Date enter by the User ...it will pickup last six date and Demand on that Date in Required Format.
    Pls Do let me know Any more Clarification
    Pls can any body Help me
    Regards
    Roshan

    CREATE TABLE t1
    ( col1 VARCHAR2(10),
    col2 VARCHAR2(100)
    INSERT INTO t1 VALUES('A','123,456,789');
    INSERT INTO t1 VALUES('B','012,345');
    INSERT INTO t1 VALUES('C','678,901,234');
    SELECT col1, col2, pos, pre, SUBSTR(col2, pre+1, pos-pre-1) token FROM (
    SELECT row_num, col1, col2, decode(pos,0,LENGTH(col2)+1,pos) pos, pre FROM (
    SELECT row_num, col1, col2, pos, nvl(LAG(pos) OVER (PARTITION BY col1 ORDER BY row_num),0) pre
    FROM (
    SELECT row_num, vw.col1, vw.col2, INSTR(vw.col2,',',1,row_num) pos
    FROM (
    SELECT ROWNUM row_num FROM (
    SELECT LEVEL FROM dual connect by LEVEL <= 5
    )) r,
    (SELECT col1, col2 FROM t1) vw
    WHERE pos <> 0 OR pre <> 0
    i think some part it may be help u also

  • How to lock a row before update using UPDATE statement ?

    I want to lock a row before updating using the UPDATE statement! is there any "reserved word" that I can append to an update statement so, that the row get locked!, also, will the lock gets released automatically once the update is done or do I have to explicitly release the lock?
    how can I do this ?
    any help is greatly appreciated.
    Thanks,
    Srini.

    For detail information, see http://otn.oracle.com/doc/server.815/a67779/ch4l.htm#10900
    The lock will be released by "commit".
    FOR UPDATE Examples
    The following statement locks rows in the EMP table with clerks located in New York and locks rows in the DEPT table with departments in New York that have clerks:
    SELECT empno, sal, comm
    FROM emp, dept
    WHERE job = 'CLERK'
    AND emp.deptno = dept.deptno
    AND loc = 'NEW YORK'
    FOR UPDATE;
    The following statement locks only those rows in the EMP table with clerks located in New York. No rows are locked in the DEPT table:
    SELECT empno, sal, comm
    FROM emp, dept
    WHERE job = 'CLERK'
    AND emp.deptno = dept.deptno
    AND loc = 'NEW YORK'
    FOR UPDATE OF emp.sal;

  • Who locks row in IOT?

    Hi,
    I have an index organized table (IOT) where I need to find the locking session for as certain row.
    I found usefull information on this website: http://www.orafaq.com/node/854
    But for some reason I annot use <tt>DBMS_ROWID.rowid_create</tt> to calculate rowid's in the IOT:    SQL> SELECT sid
          2    FROM v$lock
          3        JOIN dba_objects dbob
          4          ON (object_id = id1)
          5        JOIN v$session vds
          6          USING (sid)
          7          WHERE DBOB.OBJECT_NAME = 'PAC_ZUO_PARA_HEAD_TOP_IOT';
               SID
              2058
        SQL> SELECT to_char(DBMS_ROWID.rowid_create (1
          2                                ,  vds.row_wait_obj#
          3                                ,  vds.row_wait_file#
          4                                ,  vds.row_wait_block#
          5                                ,  vds.row_wait_row#
          6                                 ))
          7    FROM v$session vds
          8   WHERE     sid = 2058;
        SELECT to_char(DBMS_ROWID.rowid_create (1
        ERROR at line 1:
        ORA-01410: invalid ROWID
        ORA-06512: at "SYS.DBMS_ROWID", line 38
        SQL> SELECT 'rid '||rowid , zpht.*
          2    FROM  pac_zuo_para_head_top_iot zpht
          3   WHERE ZPHT.PARA_ID =   1845828150001; -- row locked by the other session
        'RID'||ROWID                                     PARA_ID TOP_PARA_ID
        rid *BAOSoyoIxwJVOx0QAQL+                     1.8458E+12  2.0797E+12
        SQL>How do I match the locked rows with the one I'm locking for?
    DB is 10.2.0.5 soon upgrading to 11.2.*
    *[edit]* waiting for a blocking lock and looking from a third session is not an option.
    bye
    TPD
    Edited by: T.PD on 01.03.2012 14:44

    I'm not sure how to answer your question, but IOTs don't use "regular" ROWIDs. They use "Logical" or "Universal" ROWIDs which DBMS_ROWID does not support.
    DBMS_ROWID is not to be used with universal ROWIDs (UROWIDs).Source: http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_rowid.htm#CIHJBJHG

Maybe you are looking for