-
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;
-
If you use variables in your sqls that are same as the column names, Oracle will use the columns instead of variables.
So change your input variable to something else like
(p_traybatch IN varchar2) as
-
thanks alot!
it works fine now..^^
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|