Please correct my code (Login Registration)
I need to return "-1" if username exixts and i need to return 1 if username is new and then insert values into table.
This procedure is for Registering UserName and Password For Login
--------------------------------------------------------------------------------------------------------------
CREATE OR REPLACE PROCEDURE debopriyo_savelogindetails
(
p_nameofuser debopriyo_logindetailstable.nameofuser%TYPE,
p_username debopriyo_logindetailstable.username%TYPE,
p_userpassword debopriyo_logindetailstable.userpassword%TYPE
)
IS
v_count number;
v_returncode number;
BEGIN
select count(t.username) into v_count from debopriyo_logindetailstable t;
if(v_count>0)
then
v_returncode := -1;
ELSE
v_returncode := 1;
INSERT INTO debopriyo_logincredentials (nameofuser, username, userpassword)
VALUES (p_nameofuser, p_username, p_userpassword);
END IF;
RETURN v_returncode;
END;