plsql - Oracle : Error at line 28: PLS-00103: Encountered the symbol “end-of-file” -


i have problem , cant figure out. shows....

error @ line 28: pls-00103: encountered symbol "end-of-file" when expecting 1 of following:

begin end function pragma procedure

  1. create or replace package body check_emp_pkg
  2. is
  3. procedure chk_hiredate
  4. (p_date in employees.hire_date%type)

this code below:

create or replace package body check_emp_pkg     procedure chk_hiredate      (p_date in employees.hire_date%type)      begin        if months_between(sysdate, p_date) > g_max_length_of_service * 12          raise_application_error(-20200, 'invalid hiredate');        end if;    end chk_hiredate;    procedure chk_dept_mgr      (p_empid in employees.employee_id%type,      p_mgr in employees.manager_id%type)      begin       declare         v_mgr_id departments.manager_id%type;       begin        select manager_id v_mgr_id        departments;        if p_mgr = v_mgr_id          dbms_output.put_line('success');        else          raise_application_error(-20200, 'manager id not match');        end if;   exception     when no_data_found       dbms_output.put_line('manager not exist');   end chk_dept_mgr; end check_emp_pkg; 

i have no idea why getting error!

you have begin , declare in second procedure. part:

  procedure chk_dept_mgr      (p_empid in employees.employee_id%type,      p_mgr in employees.manager_id%type)      begin       declare         v_mgr_id departments.manager_id%type;       begin        select manager_id v_mgr_id        ... 

should just:

  procedure chk_dept_mgr      (p_empid in employees.employee_id%type,      p_mgr in employees.manager_id%type)            v_mgr_id departments.manager_id%type;     begin      select manager_id v_mgr_id      ... 

you can kind of see indentation blocks have got out of alignment. you've started inner block when didn't need one, , not ended properly. add end after end if instead, inner block still wouldn't adding useful.


Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -