Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Select Case and insert

user534236Oct 17 2008 — edited Oct 20 2008
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;
This post has been answered by Frank Kulash on Oct 20 2008
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 17 2008
Added on Oct 17 2008
5 comments
2,685 views