Home > Back-end >  How to solve the PLS-00103 error in function in PL/SQL
How to solve the PLS-00103 error in function in PL/SQL

Time:09-27

I want to create a function that checks whether a number entered is odd or even in PL/SQL.

I created this function but it is showing the compilation error.

code:

CREATE OR REPLACE FUNCTION YES_EVEN(p_val IN NUMBER) RETURN BOOLEAN AS
v_result BOOLEAN:= FALSE;
BEGIN
    IF (p_val % 2) = 0 THEN
        v_result := TRUE;
    END IF;
    RETURN v_result;
END;
/

Error:

Error for the function

I have tried to solve this but nothing happens.

CodePudding user response:

It isn't % but MOD, I presume.

if mod(p_val, 2) = 0 then ...
  • Related