I am trying to Create a package MSGG_SESSION with a procedure authenticate that accepts two VARCHAR2 parameters for username and password. Put an package-private NUMBER variable for the current person ID. If “authenticate” matches a username and password in MSGG_USER , put the matching PERSON_ID in the new variable. when i put this into oracle sql developer i get and error. i already created a table MSGG_SESSION and a MSGG_USER table already exists. (PRIV-NUMBER is my package private number variable for the current person ID)
CREATE OR REPLACE PACKAGE MSGG_SESSION
IS
PROCEDURE AUTHENTICATE (USERNAME IN VARCHAR2, PASSWORD IN VARCHAR2);
FUNCTION AUTHENTICATED_USER RETURN VARCHAR2;
END MSGG_SESSION;
/
CREATE OR REPLACE PACKAGE BODY MSGG_SESSION
IS
PRIV_NUMBER VARCHAR2(100);
PROCEDURE AUTHENTICATE (USERNAME_TO_AUTH IN VARCHAR2, PASSWORD_TO_USE IN VARCHAR2)
IS
BEGIN
PRIV_NUMBER := NULL;
SELECT USERNAME
INTO PRIV_NUMBER
FROM
USER_PASSWORD
WHERE
lower(username) = lower(username_to_auth) and password = password_to_use;
exception
when NO_DATA_FOUND then
raise NOT_AUTHENTICATED;
when others then
raise;
END AUTHENTICATE;
FUNCTION GET_USER_ID
RETURN VARCHAR2
is
begin
return priv_number;
end get_user_id;
END MSGG_SESSION;
/