Select Case and insert
Hello,
I am trying to insert a row to another table based on row value of the select statement. Code does not seem to work, any pointers?
declare
maxRow integer := 0;
i PLS_INTEGER := 0;
begin
-- retrive max row
select max(rownum) into maxRow from temp;
-- while loop to insert values to temp2 table
while i < maxRow loop
select temp.* ,case when gross_qty = 0 then insert into temp2 values(i,client, status,0,qty,'true', 'false', 'false');
end;
from temp where rownum =i;
i := i + 1; -- loop counter
end loop;
end;