开发者

Row in table is getting locked after modifying a certain cell in it in oracle

开发者 https://www.devze.com 2023-04-10 10:54 出处:网络
I have the following code in an oracle procedure, which returns a cursor (r_cursor) as an OUT parameter

I have the following code in an oracle procedure, which returns a cursor (r_cursor) as an OUT parameter

SELECT userid
      INTO v_userid
      FROM users u
     WHERE lower(u.email) = lower(p_email)
       AND lower(u.token) = lower(p_IV);

UPDATE users u
   SET u.token = NULL,
       u.lastlogin = sysdate()
 WHERE u.userid = v_userid;

  OPEN r_cursor FOR
    SELECT u.firstname,
           u.lastname
      FROM users u
     WHERE u.userid = v_userid;

When calling the procedure from oracle everything works completely fine.

But when calling the procedure from a .Net application, the error ORA-24338: statement handle not executed is raised.

After a lot of testing, I find out that if I remove one of the lines lower(u.token) = lower(p_IV) from the SELECT statement or u.token = NULL, from the UPDATE statemen开发者_运维问答t, the cursor is returned to the .Net application without any error.


The ORA-24338 is usually raised when you try to fetch a cursor that has not been opened yet.

This could be raised for example if your procedure raised an exception before the OPEN statement. Afterwards when you try to fetch from the cursor oracle would raise the ORA-24338 since the cursor has never been opened.

Do you have an EXCEPTION block (with a WHEN OTHERS for example) in your PL/SQL, or do you catch SQL exception in .net?

0

精彩评论

暂无评论...
验证码 换一张
取 消