Re: Stored procedure invocation
Posted in 1997
>From: jamwal <jamwal@quality.com>
>Date: Thu, 07 Aug 1997 12:44:57 -0700
>X-Informix-List-Id: <news.41765>
>
>How do I invoke a stored procedure from dbaccess?
>I've tried the following two formats without success:
>
>Store procedure definition is:
> create procedure read_address(lastname char(15))
> returning char(15), char(15);
This is not a complete stored procedure, of course.
It needs a RETURN statement ideally, and an END PROCEDURE statement.
>dbaccess new command:
> EXECUTE PROCEDURE read_address('smith')
>and
> CALL read_address('smith')>
>Both calls above give me '201: A syntax error has occured.'
The EXECUTE PROCEDURE statement should execute if your procedure was
created. If this occurred after the 'create procedure' text above, then
the problem is that there is no semi-colon at the end of the statement and
therefore no separator between that and the following CALL. If the
semi-colon were in place after both the execute and call and there was an
end procedure, then you'd have a valid stored procedure that would compile.
But if you ran it, it would run into an 'infinite loop', recursing until it
ran out of space.
If you really did create a complete stored procedure, then it is less than
clear what your problem is. The EXECUTE PROCEDURE version should work in
SQL; SPBL; CALL will only work in SPL.
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>
PS: Warning I do not reply to messages with anti-spam in the return path.