I cannot find the mistake in the below code, I receive "statement ignored error" at the last line of the first select clause part of the code:

SELECT *
   BULK COLLECT INTO l_employees
      FROM employees;

But I am not sure if thats the real problem. Here is my full code

declare
  j number := 0;
  indx number;
begin
   SELECT *
   BULK COLLECT INTO l_employees
      FROM employees;
   indx := l_empoyees.count;
  for r in (select * from sde.sdeuser_abone2)
  loop
    update sde.sdeuser_abone2
       set bina_id = l_employees(indx).ID 
     where objectid = r.objectid;
  	indx := indx - 1;
  	if indx = 0 then
  	  indx := l_empoyees.count;
  	end if;
  end loop;
commit;
end;

Thanks for helping,
Yassar

Recommended Answers

All 2 Replies

What is l_employees ?

It does not have any definition in your code .

Thanks debasisdas, i am new to PL/SQL and made a silly mistake

The following code worked

declare
  j number := 0;
  indx number;
  type t_id is table of sde.sdeuser_abone_bina.ID%type;
  l_abonebina_id t_id;
begin
   SELECT id
    BULK COLLECT INTO l_abonebina_id
   FROM sde.sdeuser_abone_bina;
   indx := l_abonebina_id.count;
   for r in (select * from sde.sdeuser_abone2)
  loop
    update sde.sdeuser_abone2
       set bina_id = l_abonebina_id(indx)
     where objectid = r.objectid;
   indx := indx - 1;
   if indx = 0 then
    indx := l_abonebina_id.count;
   end if;
  end loop;
commit;
end;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.