1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

How to solve this procedure

Discussion in 'SQL PL/SQL' started by Puru, Nov 9, 2010.

  1. Puru

    Puru Forum Advisor

    Messages:
    32
    Likes Received:
    1
    Trophy Points:
    90
    1 CREATE OR REPLACE PROCEDURE p1 IS
    2 Declare
    3 a number;
    4 b number;
    5 c number;
    6 Begin
    7 a:=50;
    8 b:=89;
    9 c:=a+b;
    10 dbms_output.put_line('Sum of '||a||' and '||b||' is '||c);
    11* End;
    SQL> /

    Warning: Procedure created with compilation errors.

    Dear All,

    When I have created the procedure, I got this error. How to solve this...........
     
  2. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,351
    Likes Received:
    348
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    This has been said before -- use the show errors command to get Oracle to reveal the cause or causes of the failure:

    Code (SQL):
     
    SQL> CREATE OR REPLACE PROCEDURE p1 IS
      2  DECLARE
      3  a NUMBER;
      4  b NUMBER;
      5  c NUMBER;
      6  BEGIN
      7  a:=50;
      8  b:=89;
      9  c:=a+b;
     10  dbms_output.put_line('Sum of '||a||' and '||b||' is '||c);
     11  END;
     12  /
     
    Warning: PROCEDURE created WITH compilation errors.
     
    SQL>
    SQL> SHOW errors
    Errors FOR PROCEDURE P1:
     
    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    2/1      PLS-00103: Encountered the symbol "DECLARE" WHEN expecting one OF
             the following:
             BEGIN FUNCTION package pragma PROCEDURE subtype TYPE USE
             <an identifier> <a double-quoted delimited-identifier> form
             CURRENT cursor external LANGUAGE
     
    SQL>
    SQL> CREATE OR REPLACE PROCEDURE p1 IS
      2  -- Declare
      3  a NUMBER;
      4  b NUMBER;
      5  c NUMBER;
      6  BEGIN
      7  a:=50;
      8  b:=89;
      9  c:=a+b;
     10  dbms_output.put_line('Sum of '||a||' and '||b||' is '||c);
     11  END;
     12  /
     
    PROCEDURE created.
     
    SQL>
    SQL> SHOW errors
    No errors.
    SQL>

     
     
  3. kiran.marla

    kiran.marla Forum Genius

    Messages:
    403
    Likes Received:
    52
    Trophy Points:
    505
    Location:
    Khammam
    These are the basics.