0
CREATE OR REPLACE FUNCTION BOLUM_ADI(P_BOLUMNO IN NUMBER) RETURN VARCHAR2
IS 
  WBOLUM_ADI VARCHAR2(30);
  BEGIN

    SELECT DEPARTMENT_NAME INTO WBOLUM_ADI FROM DEPARTMENTS 
    WHERE DEPARTMENT_ID = P_BOLUMNO;
   RETURN(WBOLUM_ADI);
 END; 

and ı got this error :

PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:;

please give me some helpful advice . whenever ı want to create a function ı got errors that ıncludes this expression : In a procedure, the RETURN clause cannot contain an expression

jarlh
  • 42,561
  • 8
  • 45
  • 63
  • Which environment are you doing this in? SQL Developer? – jarlh May 25 '23 at 10:17
  • Function works in [dbfiddle](https://dbfiddle.uk/leuMhBrh). How about slash at the end? [When do I need to use a semicolon vs a slash in Oracle SQL?](https://stackoverflow.com/questions/1079949/when-do-i-need-to-use-a-semicolon-vs-a-slash-in-oracle-sql) – Ponder Stibbons May 25 '23 at 10:30
  • 1
    You need to place a forward slash (`/`) at the very end to depict the end of the statement. PL/SQL accepts semicolon as part of code so SQL\*Plus doesn't recognoze the end of your script – astentx May 25 '23 at 10:54
  • btw ı am doing SQL developer – Kubilay Akman May 25 '23 at 11:10
  • After the `END;` you need to put `/` on a newline as that is the SQL\*Plus and SQL Developer PL/SQL statement terminator. – MT0 May 25 '23 at 11:49
  • also ıt doesn't work in dbfiddle – Kubilay Akman May 25 '23 at 13:18

0 Answers0