Hello Jens, first, there are generally two LOCK modes: SHARE for reading a row (others may read too), EXCLUSIVE for writing a row. An UPDATE on a row does implicitely need an EXCLUSIVE lock, hereby waiting on the SHARE locks of other sessions, before the EXCLUSIVE lock can be acquired.
An EXCLUSIVE lock forbids other sessions to read the data, so the database is already doing what you try to do in the application. Shortly speaking, specify the NOWAIT clause, so that the sql command either get the lock, or returns with an error. Also, perhaps it would be better use a SELECT with an update clause in these cases (http://www.sapdb.org/7.4/htmhelp/ac/738eee3f4a11d3a98200a0c9449261/content.htm) which can be specified also with the NOWAIT clause. Alexander Schr�der SAP DB, SAP Labs Berlin > -----Original Message----- > From: Jens Stier [mailto:[EMAIL PROTECTED] > Sent: Thursday, July 31, 2003 8:11 AM > To: [EMAIL PROTECTED] > Subject: Row-Lock > > > Hello, > > I have an application that connects to sapdb with different users. > > if a user opens a record for editing, i want this record to > be locked for > other users. i do this with the following command: > > LOCK (NOWAIT) ROW TBLADRESSE KEY ID=15 IN SHARE MODE > > if now a second user tries to open this locked record for > editing, i have to > check whether the record is locked or not. > > How can I find out if it is locked? > > > > > regards > > Jens > > _______________________________________________ > sapdb.general mailing list > [EMAIL PROTECTED] > http://listserv.sap.com/mailman/listinfo/sapdb.general > _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general
