Subject | Re: [firebird-support] token unknown in stored procedure |
---|---|
Author | Helen Borrie |
Post date | 2005-03-31T00:34:21Z |
At 11:59 PM 30/03/2005 +0000, you wrote:
variables. So the immediate exception comes from the fact that a statement
terminator is found, instead of the expected "INTO", i.e. the unknown
(unexpected) token is the semicolon.
In fact, as this procedure proceeds, it has more and more errors, as you
refer to variables, e.g. AXPOS, POSLI and POSRI, that have not been declared.
Go back and declare variables for all of the columns whose values you need
to look at, and provide a corresponding column list for SELECT. (SELECT *
is totally inappropriate for selects in stored procedures).
Also, you have another potential source of exception, if your select
statement is capable of returning multiple rows. If that is the case, you
must use a FOR SELECT loop and allow for the possibility of multiple tuples
in the result.
./heLen
>hi all,This isn't a legal statement in PSQL - a select always has to be INTO
>
>could someone please, spot why I'm getting an error at line 16,
>
>; token unknown
>
>
>it's probably obvious but I just do not see it. everything I try
>gives that error.
>
>thanks
>Daniel
>
>SET TERM ^;
>CREATE PROCEDURE COUNTVEHTIRES
>( AX_LES INTEGER,
> IDVEH INTEGER )
>RETURNS ( ALLCOUNT INTEGER
> , SPARECOUNT INTEGER)
>AS
>DECLARE VARIABLE AX INTEGER;
>BEGIN
> AX = 0;
> ALLCOUNT = 0;
> SPARECOUNT = 0;
>
>/* WHILE ( AX <= :AX_LES ) DO */
>/* BEGIN */
>
>
> SELECT * FROM AXLES
> WHERE AXPOS = :AX
> AND IDVEH = :IDVEH
>error ==> ORDER BY AXPOS;
variables. So the immediate exception comes from the fact that a statement
terminator is found, instead of the expected "INTO", i.e. the unknown
(unexpected) token is the semicolon.
In fact, as this procedure proceeds, it has more and more errors, as you
refer to variables, e.g. AXPOS, POSLI and POSRI, that have not been declared.
Go back and declare variables for all of the columns whose values you need
to look at, and provide a corresponding column list for SELECT. (SELECT *
is totally inappropriate for selects in stored procedures).
Also, you have another potential source of exception, if your select
statement is capable of returning multiple rows. If that is the case, you
must use a FOR SELECT loop and allow for the possibility of multiple tuples
in the result.
./heLen