Может ли кто-нибудь помочь мне устранить нижеупомянутую ошибку? - PullRequest
0 голосов
/ 20 января 2020

Я сталкиваюсь с этой oracle PSQL ошибкой ORA-06533

Declare
  type empidvarray is varray(6) of employees.id%type;
  empid_array empidvarray:=empidvarray();
  c_empid employees.id%type;
  i integer(2);
  counter number(2);
begin
  select count(*) into counter from employees;
  select id into c_empid from employees where id =1;
  empid_array.extend;
  empid_array(10):=c_empid; -- array is trying to assigning the value of uninitialized position 10.
end;

ORA-06532: нижний индекс вне предела ORA-06512: в строке 11

Может ли кто-нибудь помочь решить вопрос PL SQL?

https://techytraining.com/forum/topic/plsql-exception/

1 Ответ

0 голосов
/ 20 января 2020
Declare
type empno_arr is varray(100) of emp.empno%type;
empno_arry empno_arr:=empno_arr();
c_empno emp.empno%type;
counter number(10);
begin
select count(*) into counter from emp;
select empno into c_empno
          from emp 
           where empno =7369;
empno_arry.extend(10);--Need to provide the  length of extend array. Otherwise it will consider as  index 1
empno_arry(10):=c_empno; -- array is trying to assigning the value of uninitialized position 10.
end;
...