Subject Re: [firebird-support] Array data type in Stored Proc param
Author Helen Borrie
At 01:02 AM 16/04/2005 +0100, you wrote:

>I have the following table:
>
>CREATE TABLE A4(
> COL INTEGER[0,10]
>);
>
>I then tried to create the following sp:
>
>SET TERM ## ;
>
>CREATE OR ALTER PROCEDURE sp_A4
>RETURNS (
> opCOL INT[0,10]
>)AS
>BEGIN
> FOR SELECT COL
> FROM A4
> INTO :opCOL
> DO
> BEGIN
> SUSPEND;
> END
>
>END ##
>
>SET TERM ; ##
>
>And it failed with:
>
>Token unknown - line 3, char 12
>[
>
>Is this a known issue

Yes. You can't pass an array type as an input or output argument.

>where arrays can't be data types in sp's

Arrays can't be variables. But SPs can read array elements into variables.

>or is there a problem with the sp?

Ergo....yes. :-)

What you can do in a SP is read values from an array into variables of the
appropriate data type. This makes it possible to loop through an array and
form an output tuple (along with the row keys and any other row data you
want) for a selectable SP. Up to Fb 1.5, that's the only way to read an
array slice with an SQL select statement. If you have The F. Book, there's
an example starting on P. 627.

./hb