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: Michel Cadot <micadot{at}altern{dot}org>
Date: Sun, 26 Dec 2004 08:52:45 +0100
Message-ID: <41ce6dd8$0$921$626a14ce@news.free.fr>

"vertigo" <ax178_at_wp.pl> a écrit dans le message de news:cqlq7h$fid$1_at_atlantis.news.tpi.pl...
| 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
|

This code does not work.
I think it was:

Declare

   V_sal emp.sal%TYPE;
Begin

   Select Sal Into V_sal From emp where empno = &P_empno;    if (V_sal<1000) then

      update emp set sal:=sal*1.1 where empno = &P_empno;    endif;
end;
/

It does not loop for all employees.
Have a look at:
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a90842/ch6.htm#1006806

Regards
Michel Cadot Received on Sun Dec 26 2004 - 01:52:45 CST

Original text of this message

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