Search code examples
sqloracle-databaseplsql

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


I am running the following script -

BEGIN
    select department_name 
    from egpl_department 
    where department_id in (select department_id 
                            from egpl_casemgmt_activity);
END ;

And got the Error -

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

Solution

  • In a PL/SQL block select statement should have an into clause:

    DECLARE
     v_department egpl_department.department_name%type;
    BEGIN 
      select department_name 
      into   v_department
      from   egpl_department 
      where  department_id in (select department_id from egpl_casemgmt_activity); 
    
      -- Do something useful with v_department
    END;