Help with Orcal Stored Procedure

Discussion in 'Oracle' started by waleed, Mar 1, 2009.

  1. waleed

    waleed New Member

    Joined:
    Mar 1, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I wrote this Procedure and I couldn't figers what is the problem
    can any one help me please:wacky:

    CREATE OR REPLACE PROCEDURE SelectProc
    IS
    DECLARE
    ID PRODUCT.Emp_NO%TYPE;
    Name PRODUCT.Full_Name%TYPE;
    BEGIN
    select Emp_NO,Full_Name into ID,Name from empTest;
    END SelectProc;
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Nor we can figure out unless you try to explain what you are trying to do.
     
  3. kidas

    kidas Super Moderator

    Joined:
    Nov 25, 2008
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    http://www.club-oracle.com
    hi, you cannot have DECLARE in your create procedure statement. Also it's not a good idea to use ID, NAME for variables because they are oracle reserved keywords. Here's the corrected code, it will work
    Code:
    CREATE OR REPLACE PROCEDURE selectproc
    AS
       l_ID        product.emp_no%TYPE;
       l_NAME   product.full_name%TYPE;
    BEGIN
       SELECT emp_no, full_name
         INTO l_ID, l_NAME
         FROM emptest;
         
    END selectproc;
    /
    
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice