Re: Ampersand in PL/SQL
Date: 1995/04/18
Message-ID: <D77xrB.277_at_mim.com.au>#1/1
Thomas Dunbar <tdunbar_at_gserver.grads.vt.edu> wrote:
>declare
> zzz number(5);
>begin
> select sal into zzz from emp where empno = &&aaa;
> if (zzz > 2000) then
> update emp set sal = zzz + 10 where empno = &aaa;
> else
> update emp set sal = zzz + 500 where empno = &aaa;
> end if;
> commit;
>end;
>
>yes, that works ok..the first time..when called again, tho,
>it does not prompt for value but reuses what was given before!
>
Try -
declare
zzz number(5);
aaa number(5);
begin
aaa := &aaa;
select sal into zzz from emp where empno = aaa;
if (zzz > 2000) then
update emp set sal = zzz + 10 where empno = aaa; else
update emp set sal = zzz + 500 where empno = aaa;
end if;
commit;
end;
OR
before running the script again use the SQL*Plus Command "UNDEFINE AAA". Received on Tue Apr 18 1995 - 00:00:00 CEST