Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2005
    Posts
    5

    Unanswered: Why Can't I Call This Procedure ?

    Hi, I create and then try to call the procedure below, getting errors like : SP2-0734: unknown command beginning "InsertOrde..." - rest of line ignored.

    Can anyone explain what I am doing wrong here ?

    CREATE OR REPLACE PROCEDURE InsertOrder(Drinker IN VARCHAR, Pub IN VARCHAR, Drink IN VARCHAR) IS
    countedRows NUMBER(2);
    BEGIN
    SELECT count(*) INTO countedRows
    FROM ORDERS
    WHERE ORDERS.Drinker = Drinker AND ORDERS.Pub = Pub AND ORDERS.Drink = Drink AND ODate = SYSDATE;
    INSERT INTO ORDERS VALUES (Drinker, Pub, SYSDATE, Drink, countedrows + 1);
    END InsertOrder;
    /

    InsertOrder('PETER', 'CAPTAIN MOORE', 'BEER');
    InsertOrder('PETER', 'CAPTAIN MOORE', 'BEER');
    InsertOrder('MARY', 'LONG JOHN', 'VODKA');
    InsertOrder('MARY', 'LITTLE PIRATE', 'VODKA');
    InsertOrder('MARY', 'LITTLE PIRATE', 'VODKA');

    Also, what am I doing wrong with this :

    GRANT REFERENCE Drink ON AllDrinks TO SCOTT;
    GRANT REFERENCE Pub, Drink ON Serves TO SCOTT;

    ERROR at line 1:
    ORA-00990: missing or invalid privilege

    Thanks for any help. It seems what we learn in class doesn't always work for real !

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >It seems what we learn in class doesn't always work for real !
    Maybe what you thought you learned is not reality; just wishful thinking.
    >I create and then try to call the procedure below
    SQL*Plus<>PL/SQL
    >Also, what am I doing wrong with this :
    It matters which user/schema is issuing commands & which owns objects.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Apr 2003
    Location
    Greenville, SC (USA)
    Posts
    1,155
    I agree with anacedent ... either we fell asleep during class, or had toooo
    many the night before. READ the book and study while in class !!!

    You have created a procedure called "InsertOrder". Now you must find
    a way to call this procedure ... HINT ... the way you were doing it was not right ... Try looking up how to call a stored procedure.

    You'll learn alot more if you do the homework yourself

  4. #4
    Join Date
    Oct 2002
    Location
    greenwich.ct.us
    Posts
    279
    [QUOTE=DS1984]
    Code:
    BEGIN
       InsertOrder('PETER', 'CAPTAIN MOORE', 'BEER');
       InsertOrder('PETER', 'CAPTAIN MOORE', 'BEER');
       InsertOrder('MARY', 'LONG JOHN', 'VODKA');
       InsertOrder('MARY', 'LITTLE PIRATE', 'VODKA');
       InsertOrder('MARY', 'LITTLE PIRATE', 'VODKA');
    END;
    /
    or
    Code:
    EXEC InsertOrder('PETER', 'CAPTAIN MOORE', 'BEER');
    EXEC InsertOrder('PETER', 'CAPTAIN MOORE', 'BEER');
    EXEC InsertOrder('MARY', 'LONG JOHN', 'VODKA');
    EXEC InsertOrder('MARY', 'LITTLE PIRATE', 'VODKA');
    EXEC InsertOrder('MARY', 'LITTLE PIRATE', 'VODKA');
    Also, what am I doing wrong with this :

    GRANT REFERENCE Drink ON AllDrinks TO SCOTT;
    GRANT REFERENCE Pub, Drink ON Serves TO SCOTT;

    ERROR at line 1:
    ORA-00990: missing or invalid privilege
    Code:
    GRANT REFERENCE ON AllDrinks TO SCOTT;

Posting Permissions

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