DB2 Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDB2 Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old October 11th, 2004, 07:31 AM
kelvin-c kelvin-c is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 57 kelvin-c User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 25 m 54 sec
Reputation Power: 5
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?

Reply With Quote
  #2  
Old October 12th, 2004, 12:00 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
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.

Reply With Quote
  #3  
Old October 25th, 2004, 05:21 AM
ececilla ececilla is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 1 ececilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
It looks like a Oracle stored procedure, not db2 one.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDB2 Development > pl/sql procedure


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway