Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: substitution variable
vertigo wrote:
> Hello
>
> I found code which should increase by 10% employee's salary (for those
> who earn less than 1000). Does this code work ?
> It's said that it' using substitution variables.
> I looked in documentation but there was said that i can create such
> variable by define, or accept...
>
> Declare
> V_sal emp.sal%TYPE;
> Begin
> Select Sal
> Into V_sal
> From emp
> where empno = and P_empno //?
> if (V_sal<1000) then
> update emp
> set sal:=sal*1.1
> where empno= and P_empno; //?
> endif;
> end;
>
> How this code works ? (How does it loop for all emplyees ?)
> (or maybe here is error, so how should it be corrected ?)
>
> Thanx
> Michal
The code is an overly complex solution to a simple problem and you are trying to add additional complexity to that. One does not try to create loops where none are required.
When a simple update statement will suffice: Use it!
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace 'x' with 'u' to respond)Received on Sun Dec 26 2004 - 13:19:26 CST