throwing error when creating procedure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ddddd
    New Member
    • Jun 2007
    • 4

    throwing error when creating procedure

    CREATE PROCEDURE PART6(IN a FLOAT, IN b FLOAT, OUT retval FLOAT)
    BEGIN
    retval = a * b
    END

    The above procedure creation statement throws error saying

    DB21034E The command was processed as an SQL statement because it was not a
    valid Command Line Processor command. During SQL processing it returned:
    SQL0104N An unexpected token "retval" was found following "retval FLOAT)
    BEGIN ". Expected tokens may include: "WHILE". LINE NUMBER=2.
    SQLSTATE=42601

    SQL0104N An unexpected token "retval" was found following "retval FLOAT)
    BEGIN
    ". Expected tokens may include: "WHILE ".

    Explanation:

    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.

    Can anyboby help about whats the problem.. Am running this statement in Command editor in Control Center.
  • frozenmist
    Recognized Expert New Member
    • May 2007
    • 179

    #2
    Hi,
    Try giving

    [code=sql]
    CREATE PROCEDURE PART6(IN a FLOAT, IN b FLOAT, OUT retval FLOAT)
    BEGIN
    set retval = a * b;
    END
    [/code]

    Hope it is solved,
    Cheers.

    Comment

    • ddddd
      New Member
      • Jun 2007
      • 4

      #3
      Thanks.. it solved the problem

      Comment

      Working...