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 statement, the cursor is returned to the .Net application without any error.
The
ORA-24338is 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-24338since the cursor has never been opened.Do you have an
EXCEPTIONblock (with aWHEN OTHERSfor example) in your PL/SQL, or do you catch SQL exception in.net?