If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > debug procedure.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-21-03, 19:33
minniemouse minniemouse is offline
Registered User
 
Join Date: Sep 2003
Location: US
Posts: 2
debug procedure.

Can anyone tell me what is wrong with the following? It is creating aprocedure with compilation errors.

CREATE OR REPLACE PROCEDURE get_parts (pizza IN VARCHAR2)
_
BEGIN
SELECT NAME
INTO_ temp_table
FROM pizza_items
WHERE pizza = USED_IN;
END;

iT READS FROM TABLE

CREATE TABLE PIZZA_ITEMS(id NUMBER PRIMARY KEY,
name VARCHAR2(20),
used_in VARCHAR2(20));
CREATE SEQUENCE pizza_sequence START WITH 1001;

And is meant to match the pizza name with the toppings used and place the results into temp_table
CREATE TABLE temp_table(ingredient varchar2(20));


Any ideas?
Reply With Quote
  #2 (permalink)  
Old 09-22-03, 02:17
shev shev is offline
Registered User
 
Join Date: Jul 2003
Location: Hong Kong
Posts: 56
Hi minniemouse,

Would you please post also the compilation error?
__________________
Cheers,
Shev
Reply With Quote
  #3 (permalink)  
Old 09-22-03, 05:27
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Re: debug procedure.

1) You need the keyword IS or AS before BEGIN

2) "SELECT name INTO temp_table" expects to find a VARIABLE called "temp_table", not a table. To insert data into a table requires an INSERT statement.

Try this:

Code:
CREATE OR REPLACE PROCEDURE get_parts (pizza IN VARCHAR2)
IS
BEGIN
  INSERT INTO temp_table(ingredient)
    SELECT NAME
    FROM pizza_items
    WHERE pizza = USED_IN;
END;
/
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On