indexing - PL/SQL can't put value into index by table -
i can't put value of v_emp
emp_table
. going wrong @ line:
emp_table(counter) := v_emp;
the error is:
invalid use of type name of subtype name
i can't see problem is..
create or replace procedure laatste_emp v_emp employees%rowtype; type emp_table table of employees%rowtype index pls_integer; counter number := 0; begin select * v_emp employees hire_date = (select max(hire_date) employees); dbms_output.put_line(v_emp.employee_id || ' ' || v_emp.last_name || ' ' || v_emp.hire_date); exception when too_many_rows in 100 .. 206 loop select * v_emp employees employee_id = , hire_date = (select max(hire_date) employees); if sql%found emp_table(counter) := v_emp; counter := counter + 1; end if; end loop; end; /
your type emp_table table of employees%rowtype index pls_integer;
declares type, not actual variable can write into. need add variable too:
type emp_table_type table of employees%rowtype index pls_integer; emp_table emp_table_type;
please note added "_type" suffix definition.
Comments
Post a Comment