Results 1 to 3 of 3

Thread: pl/sql package

  1. #1
    Join Date
    Mar 2012
    Posts
    1

    Thumbs up Unanswered: pl/sql package

    hi
    this is my code:

    create or replace package LIBRARY
    AS
    procedure VIEWBOOK(Bookid NUMBER ,found OUT BOOLEAN);
    Function ADDBOOK(Bookid Number) return VARCHAR2;
    END LIBRARY;

    CREATE OR REPLACE package body LIBRARY
    AS
    PROCEDURE VIEWBOOK(Bookid NUMBER ,found OUT BOOLEAN)
    is
    result NUMBER := 0;
    temp number;
    remainder NUMBER;
    BEGIN
    temp := Bookid;
    LOOP EXIT WHEN Bookid<=0
    remainder := MOD(Bookid,10);
    result := (result*10) + remainder;
    Bookid := floor(Bookid / 10);
    END LOOP;
    IF temp=result THEN
    found:= TRUE;
    ELSE
    found:= FALSE;
    END IF;
    when others then
    dbms_output.put_line('error:'||sqlerrm)
    END;
    FUNCTION ADDBOOK(Bookid Number) return VARCHAR2
    as
    returnsate varchar2(50);
    BEGIN
    IF ((Bookid=1111)or(Bookid=2222)or(Bookid=3333)or(Boo kid=4444)or(Bookid=5555))
    returnsate:= 'ADDDED';
    else
    returnsate:= 'NOTADDED';
    END IF
    return returnsate;
    END;
    END LIBRARY;


    i found follwing errors:
    Error at line 12: PLS-00103: Encountered the symbol "=" when expecting one of the following:

    constant exception
    table long double ref
    char time timestamp interval date binary national character
    nchar

    CAN SOME ONE HELP ME.THANKS IN ADVANCE.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    posted code has plethora of syntax errors.
    you should write code one line at a time using only valid syntax;
    because some errors mask other errors confuses the compiler
    there are THREE syntax errors in just the FUNCTION alone.
    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
    Nov 2003
    Posts
    2,935
    Provided Answers: 12

Posting Permissions

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