BoulderBum
Programmer
I'm trying to convert a SQL Server stored procedure to an Oracle package, but I'm running into a bit of trouble with a sub-query:
I get an error that I have an extra right-parenthesis (ORA-00907), but I discovered the real heart of the issue has something to do with:
because if I just replace the above with a simpler query everything works well.
I'm sure this is a simple problem, but this is only my second day really working with Oracle and I'm still pretty clueless. What am I missing?
Code:
procedure TRIM_PASSWORD_HISTORY
(
p_USER_ID IN VARCHAR2
)
is
begin
DELETE FROM PASSWORD_HISTORY
WHERE USER_ID = p_USER_ID
AND PASSWORD_HISTORY_SEQ_NO
NOT IN
(
SELECT
/*+ FIRST_ROWS(24) */
PASSWORD_HISTORY_SEQ_NO
FROM PASSWORD_HISTORY
WHERE USER_ID = p_USER_ID
ORDER BY INSERTED_DATE DESC
);
end;
I get an error that I have an extra right-parenthesis (ORA-00907), but I discovered the real heart of the issue has something to do with:
Code:
SELECT
/*+ FIRST_ROWS(24) */
PASSWORD_HISTORY_SEQ_NO
FROM PASSWORD_HISTORY
WHERE USER_ID = p_USER_ID
ORDER BY INSERTED_DATE DESC
because if I just replace the above with a simpler query everything works well.
I'm sure this is a simple problem, but this is only my second day really working with Oracle and I'm still pretty clueless. What am I missing?