Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: substitution variable

Re: substitution variable

From: DA Morgan <damorgan_at_x.washington.edu>
Date: Sun, 26 Dec 2004 11:19:26 -0800
Message-ID: <41cf0db5$1_1@127.0.0.1>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US