Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2012
    Posts
    23

    Unanswered: Creating a procedure

    I got the Learn Oracle from Oracle book and been following few of the steps in order to learn Oracle.
    I wrote this sintax in PL/SQL, and got an error message. Do you know how to declare the 'CUSTOMERS.CUSTOMER_ID' ?

    SQL> CREATE PROCEDURE new_cust
    2 (p_id IN customers.customer_id%TYPE
    3 , p_lastname IN customers.cust_last_name%TYPE
    4 , p_fisrtname IN customers.cust_first_name%TYPE)
    5 IS
    6 BEGIN
    7 INSERT INTO customers
    8 (customer_id, cust_last_name, cust_first_name)
    9 VALUES
    10 (p_id, p_lastname, p_firstname);
    11 COMMIT;
    12 END new_cust;
    13 /

    Advertencia: Procedimiento creado con errores de compilación.

    SQL> SHOW ERROR
    Errores para PROCEDURE NEW_CUST:

    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    0/0 PL/SQL: Compilation unit analysis terminated
    2/10 PLS-00201: identifier 'CUSTOMERS.CUSTOMER_ID' must be declared

    Thanks!

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    does current USER have CUSTOMERS table?

    SQL> DESC CUSTOMERS

    post results from SQL above
    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
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    The command

    p_lastname IN customers.cust_last_name%TYPE

    means define a parameter p_lastname with the same structure as the cust_last_name from the customers table.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

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