Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003

    Unanswered: Procedure compilation problems

    Im not sure whats going on but when i create the following procedure using the development center it compiles ok.

    CREATE PROCEDURE GIRS.PR_GetNextSeqNumber ( IN i_SequenceName VARCHAR(50),
    OUT o_SequenceNumber INTEGER )
    -- SQL Stored Procedure
    -- SequenceName
    -- SequenceNumber Next sequence number
    P1: BEGIN
    UPDATE SystemSequences
    SET CurrentSequenceNo = CurrentSequenceNo + 1
    WHERE SequenceName = i_sequencename;
    SELECT CurrentSequenceNo INTO o_SequenceNumber
    FROM SystemSequences
    WHERE SequenceName = i_SequenceName;
    END P1

    However when I try to create the same procedure using the command center or the db2 command line (using db2 -tvf scriptname.sql) I get the following error:

    SQL0104N An unexpected token "END-OF-STATEMENT" was found
    following "END P1 ". Expected tokens may include: "JOIN
    <joined_table> ".


    A syntax error in the SQL statement was detected at the specified
    token following the text "<text>". The "<text>" field indicates
    the 20 characters of the SQL statement that preceded the token
    that is not valid.

    As an aid to the programmer, a partial list of valid tokens is
    provided in the SQLERRM field of the SQLCA as "<token-list>".
    This list assumes the statement is correct to that point.

    The statement cannot be processed.

    User Response:

    Examine and correct the statement in the area of the specified

    sqlcode : -104

    sqlstate : 42601

    Im running db2 8.1 personal edition on windows 2000

  2. #2
    Join Date
    Jan 2003
    Provided Answers: 5
    Your problem is the termination character for statements. Using the -tvf means that the termination character is the semicolon (. Well the Create Procedure does not end until your END P1. Chane the termination character to something else (most people use @). Put the @ on the end. And try again.



Posting Permissions

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