Run Oracle Procedure just to lock row, without returning a resultset

Posted by Pascal on Stack Overflow See other posts from Stack Overflow or by Pascal
Published on 2011-02-27T15:20:56Z Indexed on 2011/02/27 15:24 UTC
Read the original article Hit count: 208

Filed under:
|
|

I want to run a procedure to force a row lock on a row, but I don't want to return a result set to the client, nor do I actually want to update anything. Below is the proc:

CREATE OR REPLACE PROCEDURE SP_LOCK_Row
 (IDRow IN INTEGER)
IS
BEGIN
  SELECT *
  FROM TBLTable
  WHERE IDRow = IDRow 
  FOR UPDATE;
END;

The problem is that I keep getting the error: PLS-00428: an INTO clause is expected in this SELECT statement. Is there a way for me to lock the row without actually having to return a result set back to the client? The SQL Server equivalent is:

CREATE PROCEDURE dbo.SP_LOCK_Row(
  @IDRow INT)
AS
SELECT *
FROM dbo.TBLTable WITH (UPDLOCK, ROWLOCK)
WHERE IDRow = @IDRow

Tks

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about stored-procedures