Results 1 to 2 of 2

Thread: PL/SQL procedure help

Hybrid View

  1. #1
    Join Date
    Nov 2009
    Posts
    4

    PL/SQL procedure help

    I am creating a procedure that allows me to increase a price for a specific hotel room in a specific hotel. however, when i try to compile the code i get this error:

    Compilation failed,line 3 (16:03:02)
    PLS-00103: Encountered the symbol "CREATE" when expecting one of the following: begin function package pragma procedure subtype type use form current cursor external language

    im not sure how to fix this. can anyone shed some light on this error?

    here is a copy of my code:

    create or replace procedure adjust_hotel
    (hotel_name varchar2,
    room# varchar2,
    pct_adjust number) IS
    current_val number(7,2);
    new_current_val number(7,2);
    adj_comments varchar2(100);

    begin
    select price into current_val
    from room, hotel
    where room#=room_no
    and hotel_name=name;

    declare new_current_value number(7,2);

    new_current_val:= current_val*(1 + pct_adjust);

    update room
    set price=new_current_val
    where room#=room_no
    and hotel_name=name;

    adj_comments:= 'Price adjusted from ' || to_char(current_val,'$99999.99') || ' to ' || to_char(new_current_value,'$99999.99');


    insert into hotel_adjustment
    (adjustment_no, adjustment_date, hotel_no, room_no, comments)
    values
    (hotel_adj_seq.nextval, sysdate, hotel_no, branch_no, adj_comments);

    end adjust_hotel;

  2. #2
    Join Date
    Nov 2009
    Posts
    4
    ok so very noob of me but i had the naming of the procedure off by a few characters so it did not match up (i am programming this in the objects brower in oracle). not however i get the following errors and have no idea what to do about them:

    Compilation failed,line 17 (16:14:19)
    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 The symbol "" was substituted for "=" to continue.

    Compilation failed,line 19 (16:14:19)
    PLS-00103: Encountered the symbol "UPDATE" when expecting one of the following: begin function package pragma procedure subtype type use form current cursor The symbol "begin" was substituted for "UPDATE" to continue.

    Compilation failed,line 33 (16:14:19)
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: begin case declare end exception exit for goto if loop mod null pragma raise return select update while with << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe

Posting Permissions

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