Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Location
    US
    Posts
    2

    Unanswered: 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?

  2. #2
    Join Date
    Jul 2003
    Location
    Hong Kong
    Posts
    56
    Hi minniemouse,

    Would you please post also the compilation error?
    Cheers,
    Shev

  3. #3
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    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;
    /

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •