DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: what's wrong with this?

  1. #1
    Join Date
    Feb 2001
    Posts
    17

    Exclamation

    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;

  2. #2
    Join Date
    May 2000
    Posts
    58
    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




  3. #3
    Join Date
    Feb 2001
    Posts
    17
    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
  •  


Click Here to Expand Forum to Full Width