|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
pl/sql procedure
i am trying to create a procedure in pl/sql.
it's named loenn, which takes a percentage and a staffnumber as arguments. the percentage tells how much the salary should increase for that staffnumber. the DBMS_OUTPUT should tell 1 of these: the row was updated. the staff does not exist. the staff has no salery. Code:
SET SERVEROUTPUT ON
CREATE OR REPLACE PROCEDURE loenn(p_prosent IN NUMBER, p_ansnr IN NUMBER)
IS
ansattEksistererIkke EXCEPTION;
ikkeOppgittLoenn EXCEPTION;
v_loenn ansatt.timeloenn%type;
v_ansnr ansatt.ansnr%type;
BEGIN
SELECT timeloenn, ansnr INTO v_loenn, v_ansnr from ansatt;
UPDATE ansatt SET timeloenn = timeloenn * (1 + p_prosent/100)
WHERE ansnr = p_ansnr;
IF v_loenn = null THEN RAISE ikkeOppgittLoenn; END IF;
IF v_ansnr = null THEN RAISE ansattEksistererIkke; END IF;
DBMS_OUTPUT.PUT_LINE('Raden ble oppdatert');
EXCEPTION
WHEN ansattEksistererIkke THEN
DBMS_OUTPUT.PUT_LINE('Ansatt eksisterer ikke');
WHEN ikkeOppgittLoenn THEN
DBMS_OUTPUT.PUT_LINE('Vedkommende ansatt har ikke oppgitt noen timeloenn');
END loenn;
/
can someone help me? |
|
#2
|
||||
|
||||
|
I don't really recongnize all of the commands that you are using in the above stored procedure, but then again I don't do much in them.
You might want to first look here: https://aurora.vcu.edu/db2help/db2a0/frame3.htm#storproc This is the db2 help section for stored procedures. |
|
#3
|
|||
|
|||
|
It looks like a Oracle stored procedure, not db2 one.
|
![]() |
| Viewing: Dev Shed Forums > Databases > DB2 Development > pl/sql procedure |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|