SunQuest
           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:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old November 8th, 2005, 08:03 PM
spud311311 spud311311 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: Australia
Posts: 37 spud311311 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 13 m 4 sec
Reputation Power: 5
calling a function from a procedure pl/SQL

im not quite sure what im doing wrong with this procedure. Errors say that i cannot call the function getprice from the inside of SQL. but i dont know where else to do it .

Code:
CREATE OR REPLACE
PROCEDURE createorderitem(p_orderid number,p_itemid ITEM.itemid%TYPE,qty NUMBER) IS
-- procedure to create an order item for specifi orderid and custid

v_orderid	NUMBER;
v_itemid	ITEM.itemid%TYPE;
v_QTY		NUMBER;

INVALID_ORDER_ID EXCEPTION;

BEGIN

	SELECT orders.orderid INTO v_orderid
	FROM orders
	WHERE p_orderid=orders.orderid;

	IF SQL%NOTFOUND THEN
		RAiSE INVALID_ORDER_ID;
	END IF;


	SELECT item.itemid INTO v_itemid
	FROM item
	WHERE p_itemid=item.itemid;		

	IF SQL%NOTFOUND THEN
		RAiSE INVALID_ITEM_ID;
	END IF;


INSERT INTO orderitem
VALUES (v_orderid, v_itemid, qty, getprice(v_itemid));


EXCEPTION
	WHEN INVALID_ORDER_ID THEN
	dbms_output.put_line('INVALID ORDER ID');

	WHEN INVALID_ITEM_ID THEN
	dbms_output.put_line('INVALID ITEM ID');


END createorderitem;
/



any help would be super

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDB2 Development > calling a function from a procedure pl/SQL


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 5 hosted by Hostway