Stack Exchange
Trying to compile package body and i get Error(37,6): PLS-00103: Encountered the symbol ";" when expecting one of the following: if
I am attempting to compile a package body to test a procedure in the package and I keep getting the above error.
CREATE TABLE TempBicycle AS
SELECT * FROM bike_shop.bicycle;

CREATE OR REPLACE PACKAGE BIKESHOP AS

    PROCEDURE EXTRACT_BICYCLES (output_type IN VARCHAR2);
    PROCEDURE EXTRACT_CUSTOMERS;
    FUNCTION  CUSTOMER_BIKES RETURN BOOLEAN;
    PROCEDURE ARCHIVE_CUSTOMER_BIKES;

    count NUMBER(38,0);

    CURSOR ext_bikes_cur IS
    SELECT SerialNumber, ModelType, PaintID, FrameSize, OrderDate, StartDate, ShipDate, Construction, ListPrice,
            SalePrice, SalesTax, SaleState
    FROM TempBicycle
    ORDER BY OrderDate ASC;

END BIKESHOP;
/

CREATE OR REPLACE PACKAGE BODY BIKESHOP AS

  PROCEDURE EXTRACT_BICYCLES (output_type IN VARCHAR2) IS
  BEGIN
    IF output_type = 'D' THEN
        count := 0;
        FOR Bikes IN ext_bikes_cur LOOP
            INSERT INTO bicycles
            ( SerialNumber, ModelType, PaintID, FrameSize, OrderDate, StartDate, ShipDate, Construction, ListPrice,
                SalePrice, SalesTax, SaleState)
            VALUES ( Bikes.SerialNumber, Bikes.ModelType, Bikes.PaintID, Bikes.FrameSize, Bikes.OrderDate, Bikes.StartDate, 
            Bikes.ShipDate, Bikes.Construction, Bikes.ListPrice, Bikes.SalePrice, Bikes.SalesTax, Bikes.SaleState);
            count := count +1;
        END LOOP;
        DBMS_OUTPUT.PUT_LINE('Records Inputted: ' || count);
    ELSE IF output_type = 'S' THEN
        FOR Bikes IN ext_bikes_cur LOOP
            DBMS_OUTPUT.PUT_LINE(chr(10) || '----------Bike Information----------');
            DBMS_OUTPUT.PUT_LINE ('Serial Number: ' || Bikes.SerialNumber);
            DBMS_OUTPUT.PUT_LINE ('Model: ' || Bikes.ModelType);
            DBMS_OUTPUT.PUT_LINE ('Paint ID: ' || Bikes.PaintID);
            DBMS_OUTPUT.PUT_LINE ('Frame: ' || Bikes.FrameSize);
            DBMS_OUTPUT.PUT_LINE ('Date Ordered: ' || Bikes.OrderDate);
            DBMS_OUTPUT.PUT_LINE ('Start Date: ' || Bikes.StartDate);
            DBMS_OUTPUT.PUT_LINE ('Date Shipped: ' || Bikes.ShipDate);
            DBMS_OUTPUT.PUT_LINE ('Construction: ' || Bikes.Construction);
            DBMS_OUTPUT.PUT_LINE ('Listed Price: ' || Bikes.ListPrice);
            DBMS_OUTPUT.PUT_LINE ('Sale Price: ' || Bikes.SalePrice);
            DBMS_OUTPUT.PUT_LINE ('Sales Tax: ' || Bikes.SalesTax);
            DBMS_OUTPUT.PUT_LINE ('State Sold: ' || Bikes.SaleState);
        END LOOP;   
    ELSE 
        DBMS_OUTPUT.PUT_LINE('Incorrect Input');
    END IF;   
  END;

  PROCEDURE EXTRACT_CUSTOMERS IS
  BEGIN
    NULL;
  END;

  FUNCTION  CUSTOMER_BIKES RETURN BOOLEAN IS
  BEGIN
    RETURN TRUE;
  END;

  PROCEDURE ARCHIVE_CUSTOMER_BIKES IS
  BEGIN
    NULL;
  END;

END BIKESHOP;
/

BEGIN
    BikeShop.ExtractBicyclesaz('S');
END

I am wanting the procedure to print out to the console the contents of the cursor if the procedure is passed an "S" and for it to input the cursor data if it is passed a "D"
Error(37,6): PLS-00103: Encountered the symbol ";" when expecting one of the following:     if

PL/SQL uses ELSIF, not ELSE IF. Correct that in EXTRACT_BICYCLES and you should be good.
Well, actually ELSE IF is allowed, but it changes the structure of the statements. For example, what you're trying to do is
IF something THEN
  ya_da;
ELSIF something_else THEN
  ya_da_ya_da;
ELSE
  the_other_thing;
END IF;

If you really wanted to use ELSE IF the code structure would become
IF something THEN
  ya_da;
ELSE
  IF something_else THEN
    ya_da_ya_da;
  ELSE
    the_other_thing;
  END IF;
END IF;

So you end up needing an END IF for the "outer" IF statement, and a second END IF for the "inner" IF statement.

.....That worked I'm sad because I looked at that specific issue 3 different times and thought it looked right.   After that, I now have an even weirder error "Error(37,6): PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:     begin end function pragma procedure "

In your main routine you're got BikeShop.ExtractBicyclesaz. Did you mean BikeShop.ExtractBicycles? You're also missing a semicolon after END in the main routine.

I did end up noticing that and fixing that while I have been messing with things to get this to work. If I try to compile the entire package body I get "Error(15,22): PLS-00204: function or pseudo-column 'COUNT' may be used inside a SQL statement only." Which I don't ever use a COUNT. If I try to just run the procedure by itself I get the error I listed above. I am not really sure what I am missing to get the count error though.

You have a variable named COUNT in the package body (count NUMBER(38,0);). I usually use a kind of relaxed form of Hungarian notation for variable names, just because there are so many reserved words in Oracle and SQL and I got tired of having messages like this pop up all the time. I'd probably call this variable nCount if it was my code, but it's not. :-)

Sorry - I meant "...variable COUNT in the package SPEC".
