Ampersand in PL/SQL
Date: 1995/04/14
Message-ID: <D70Hpp.904_at_mail.auburn.edu>#1/1
Hello There,
I typed the following PL/SQL block in a file.
declare
zzz number(5);
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;
aaa number(5);
begin
commit;
/
At the SQL prompt, I started the file.
SQL> start vm_12.sql;
Enter value for aaa: 7369
old 5: select sal into zzz from emp where empno = &aaa;
new 5: select sal into zzz from emp where empno = 7369;
PL/SQL procedure successfully completed.
SQL> select sal, empno from emp;
SAL EMPNO
---------- ----------
800 7369 1600 7499 1250 7521 2975 7566 1250 7654 2850 7698 2450 7782 3000 7788 5000 7839 1500 7844 1100 7876 SAL EMPNO
---------- ----------
950 7900 3000 7902 1300 7934
14 rows selected.
Salary(800) for empno 7369 is not changed. Is ampersand allowed in PL/SQL ? If so, why the salary is not being updated. When I invoke sqlplus, the following information is displayed on my screen.