I made this stored procedure and i found something wrong on update statement..because it update all traybatches even though i used where clause.
please help me out ..i am kinda novice in plsql.^^;

(traybatch IN varchar2) as

cnt number;

begin
select count(*) into cnt from vztray where traybatch = traybatch;
if cnt=0 then
insert into vztray(traybatch,comments)
values(traybatch, to_char(sysdate,'MM/DD/YY'));

else
update vztray set comments = to_char(sysdate,'MM/DD/YY')
where traybatch = traybatch;
end if;

begin
for i in 1..100
loop
insert into vzdata.vzdata(traybatch,cellnumber) values (traybatch,to_char(i,'fm009'));
end loop;
end;
end;