Reputation:
This PL/SQL statement:
FUNCTION f_comparestring(ps_string1 VARCHAR2, ps_string2 VARCHAR2) RETURN VARCHAR2 IS
ps_match VARCHAR2(5);
BEGIN
IF (ps_string1 = ps_strin2) THEN
ps_match := 'TRUE';
ELSE
ps_match := 'FALSE';
END IF;
RETURN ps_match;
END;
Raises the following error:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: begin end function pragma procedure
I am pretty much at a loss. This appears to be a rather simple statement. Can anyone help?
Upvotes: 0
Views: 3762
Reputation:
It should be ps_string2
not ps_strin2
in the IF
. To create a function you need to use create function
You also need a /
after the PL/SQL block.
For details see: https://stackoverflow.com/a/10207695/330315
So the correct statement is:
CREATE FUNCTION f_comparestring(ps_string1 VARCHAR2, ps_string2 VARCHAR2) RETURN VARCHAR2 IS
ps_match VARCHAR2(5);
BEGIN
IF (ps_string1 = ps_string2) THEN
ps_match := 'TRUE';
ELSE
ps_match := 'FALSE';
END IF;
RETURN ps_match;
END;
/
Upvotes: 1