PLS-00103 Met the symbol & ldquo; BEGIN & rdquo;

advertisements

This may be a repeat question but I'm very new with pl sql so I'm going to ask it anyways. I wrote a function that is supposed to determine if a varchar2 contains all alpha characters. It is defined as...

CREATE OR REPLACE FUNCTION isAlpha (al IN VARCHAR2) RETURN CHAR;
BEGIN
FOR i in 1..LENGTH(al) LOOP
IF ASCII(SUBSTR(al, i, 1)) < 65 OR ASCII(SUBSTR(al, i, 1)) > 90
THEN RETURN 'F';
END IF;
END LOOP;
RETURN 'T';
END isAlpha;

I am receiving the error Error(1,1): PLS-00103: Encountered the symbol "BEGIN" and I have no clue what it's getting at. I've tried debugging it for a decent amount of time with no luck. Thanks for any responses.


Your syntax is slightly off - get rid of the ; after the RETURN clause, and add an AS:

CREATE OR REPLACE FUNCTION isAlpha (al IN VARCHAR2) RETURN CHAR AS
BEGIN
...

See the Oracle documentation for further information