Subject | Re: [firebird-support] Array data type in Stored Proc param |
---|---|
Author | Helen Borrie |
Post date | 2005-04-16T01:21:07Z |
At 01:02 AM 16/04/2005 +0100, you wrote:
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
>I have the following table:Yes. You can't pass an array type as an input or output argument.
>
>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
>where arrays can't be data types in sp'sArrays 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