Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2011
    Posts
    25

    Unanswered: PLS-00103: Encountered the symbol ";" when expecting one of the following:

    Hi everyone

    Guys I need some quick help !!

    Below is mentioned the error that is produced while creating the procedure with the help of file insert_dept.sql

    create or replace procedure dept_insert
    (dept_id IN number,
    dept_name IN varchar,
    location_id IN number
    ) AuthId current_user
    is
    pragma_autonomous_transaction;
    begin
    insert into departments (department_id,department_name,location_id) values (dept_id, dept_name,location_id);
    dbms_output.put_line (" One row inserted..... ");
    commit;
    exception
    when dup_val_on_index then
    dbms_output.put_line (" Duplicate value..... ");
    end;
    /


    SQL> @c:\insert_dept

    Warning: Procedure created with compilation errors.

    SQL> show error
    Errors for PROCEDURE DEPT_INSERT:

    LINE/COL ERROR
    -------- ---------------------------------------------------------------
    7/31 PLS-00103: Encountered the symbol ";" when expecting one of the
    following:
    constant exception <an identifier>
    <a double-quoted delimited-identifier> table LONG_ double ref
    char time timestamp interval date binary national character
    nchar
    The symbol "exception" was substituted for ";" to continue.


    Yours efforts will be greatly appreciated

  2. #2
    Join Date
    Nov 2003
    Posts
    2,934
    Provided Answers: 12
    Character (String) literals need to go in single quotes, not double quotes:
    Code:
    dbms_output.put_line (" One row inserted..... ");
    should be
    Code:
    dbms_output.put_line (' One row inserted..... ');
    And please use [code] tags to format your SQL code in the future

  3. #3
    Join Date
    Oct 2011
    Posts
    25
    Hi Shammat,

    I have tried the code with single quotes but the problem still persist !

    n other thing that I want to confirm is whether to use [code] brackets in place of (code) : for example -


    create or replace procedure dept_insert
    [dept_id IN number,
    dept_name IN varchar,
    location_id IN number
    ] AuthId current_user
    is
    pragma_autonomous_transaction;
    begin
    insert into departments (department_id,department_name,location_id) values (dept_id, dept_name,location_id);
    dbms_output.put_line [ 'One row inserted..... '];
    commit;
    exception
    when dup_val_on_index then
    dbms_output.put_line [' Duplicate value..... '];
    end;
    /

  4. #4
    Join Date
    Nov 2003
    Posts
    2,934
    Provided Answers: 12
    you have to use ( brackets in the SQL code. Please go through the PL/SQL developers manual. You seem to be lacking fundamental knowledge about the syntax.

    The remark regarding the [code] tag is for this forum to format the SQL you are posting.
    For details on how to use it see: http://www.dbforums.com/misc.php?do=bbcode#code

Posting Permissions

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