Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2005
    Posts
    5

    Unanswered: procedure syntax error (was "Pls-00103")

    Hi:

    i'm trying to run a procedure to insert numbers 1 to 200 into a field in a table as below:

    BEGIN
    DECLARE x NUMBER := 1;
    WHILE x < 201 LOOP
    INSERT INTO VISITOR VALUES(x);
    x := x+1;
    END LOOP;
    END;

    but i get this error message:
    ORA-06550: line 3, column 9:
    PLS-00103: Encountered the symbol "<" when expecting one of the following:

    := . ( @ % ; not null range default character

    plz help.

    Thanks

  2. #2
    Join Date
    Mar 2004
    Posts
    480
    Is this actually a mysql question? If not you might want to post it under the right discussion area of the site to get a quicker answer?

  3. #3
    Join Date
    Dec 2003
    Location
    Oklahoma, USA
    Posts
    354
    Sheikha,

    Problem is in the order of your sql statements. The BEGIN should not come before a DECLARE statement... try this:

    Code:
    DECLARE x NUMBER := 1;
    BEGIN
      WHILE x < 201 LOOP
       INSERT INTO VISITOR VALUES(x);
       x := x+1;
      END LOOP;
    END;
    It should work fine. Declarative section of programs usually are required to come before the execution section... fyi.
    Last edited by joebednarz; 01-05-05 at 14:15.
    JoeB
    save disk space, use smaller fonts

Posting Permissions

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