Subject Re: [ib-support] Problem with FB's SP
Author Martijn Tonies
Hi,

Glad to see you found the list :)

> I have this SP:
>
> CREATE PROCEDURE GETVALUE (TblIndex Varchar(30),
> FldIndex Integer)
> returns (FldValue Varchar(255))
> AS
> declare variable counter Integer;
> begin
> counter = 0;
> for select VALORE FROM Tabella having( Select * FROM DOC_Tabella WHERE
> ID_TABELLA=:TblIndex)
> into FldValue
> counter = counter+1
> if counter < FldIndex then
> skip;
> if counter > FldIndex then
> exit;
> Suspend;
> end

What's the error message you're getting?

From my personal syntax-check tool, you need a DO after a FOR SELECT clause.
Also, it's better to use : before the variables in the INTO clause. I also
don't
see a BEGIN END block after your FOR SELECT while it seems you're trying
to execute multiple statements (counter + 1, if counter < etc)...

Why are you using FOR SELECT anyway? Why not use a SELECT INTO statement?

Why are you using SUSPEND?

The source you've posted above is plain wrong at multiple places...




With regards,

Martijn Tonies
InterBase Workbench - the developer tool for InterBase
http://www.upscene.com

Firebird Workbench - the developer tool for Firebird
http://www.upscene.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."