Problem is that when i am tyring to make my funtion having 2 different statements during compile it happen error

This is my whole function to update password but it have errors during compile

create or replace FUNCTION updatePassword(
CurrentP VARCHAR2,
NewPwd VARCHAR2,
StudentId number)
RETURN number

    is
        getCount number :=0;

    BEGIN
        Select count(*) into getCount from users where student_id=StudentId and Password=md5(CurrentP);
        if getCount = 1
        then 
        update users set Password=md5(NewPwd) where student_id=StudentId and Password=md5(CurrentP);
      insert into users_log(Passwords,student_id,updated_by,action) values(md5(CurrentP),StudentId,StudentId,'Change');
        else
        getCount := 0;
        end if;
    RETURN getCount;
    END;

below is for same action for another screen but happen error during compile image is provided

enter image description here

    DECLARE
    NazimId number;
    BEGIN
        Select count(*) into getCount from nazim_login where nazim_id=NazimId and Password=md5(CurrentP);
        if getCount = 1
        then 
        update nazim_login set Password=md5(NewPwd) where nazim_id=NazimId and Password=md5(CurrentP);
      insert into nazim_password_log(Passwords,nazim_id,updated_by,action) values(md5(CurrentP),NazimId,NazimId,'Change');
        else
        getCount := 0;
        end if;
    RETURN getCount;
    END;


BEGIN
        Select count(*) into getCount from users where student_id=StudentId and Password=md5(CurrentP);
        if getCount = 1
        then 
        update users set Password=md5(NewPwd) where student_id=StudentId and Password=md5(CurrentP);
      insert into users_log(Passwords,student_id,updated_by,action) values(md5(CurrentP),StudentId,StudentId,'Change');
        else
        getCount := 0;
        end if;
    RETURN getCount;
    END;

below is for same action for another screen but happen error during compile

DECLARE
    NazimId number;
    BEGIN
        Select count(*) into getCount from nazim_login where nazim_id=NazimId and Password=md5(CurrentP);
        if getCount = 1
        then 
        update nazim_login set Password=md5(NewPwd) where nazim_id=NazimId and Password=md5(CurrentP);
      insert into nazim_password_log(Passwords,nazim_id,updated_by,action) values(md5(CurrentP),NazimId,NazimId,'Change');
        else
        getCount := 0;
        end if;
    RETURN getCount;
    END;

compile function with both begin and end statements

0 Answers