Subject Re: Declare and use array datatype in stored procedures
Author jb303@ymail.com
Thanks for the answer, but the given link describes the array column type, so I'd have to create a table to use it, and if I have to create a table, I can as well create a table with the following structure: test_tab(key number, value varchar(40)) which suits my needs.

What I'm asking for is an in-memory array (like in the example I posted in my first post). I don't need the array to permanently store the data in tables, I need it only for intermediate calculations in a stored procedure (e.g. like PL/SQL collections in Oracle http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/collections.htm, arrays in Java http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html, arrays in C++ http://msdn.microsoft.com/en-us/library/7wkxxx2e.aspx, etc.), so only a simple in-memory key-value structure.

Regards

--- In firebird-support@yahoogroups.com, "Hans" <hhoogstraat@...> wrote:
>
> http://ibexpert.net/ibe/index.php?n=Doc.Array
>
> -----Original Message-----
> From: firebird-support@yahoogroups.com
> [mailto:firebird-support@yahoogroups.com] On Behalf Of jb303@...
> Sent: Sunday, December 30, 2012 9:10 AM
> To: firebird-support@yahoogroups.com
> Subject: [firebird-support] Declare and use array datatype in stored
> procedures
>
> Hi,
>
> Maybe this question was already answered, but I searched and couldn't find a
> suitable answer. If so, please point me to an existing answer/FB document.
>
> What I'd like to know is if Firebird (2.0.6) supports in-memory arrays in
> stored procedures? The closest answer I found was here:
> http://tech.groups.yahoo.com/group/firebird-support/message/92470. The OP
> declared an array of 5 elements of type varchar(40), and that's exactly the
> functionality I'd need. Unfortunately if I try to create a sample stored
> procedure which uses the array, I get the "Token unknown" error for the
> character "[" (the OP also mentioned this error, but he also wrote that the
> problem was the missing "set term", which I included). Output from isql:
>
> SQL> set term ! ;
> SQL> CREATE PROCEDURE test
> CON> returns (t VarChar(40))
> CON> AS
> CON> declare vals varchar (40)[5];
> CON> begin
> CON> vals[1] = 'value 1';
> CON>
> CON> t = vals[1];
> CON> suspend;
> CON> end!
> Statement failed, SQLCODE = -104
> Dynamic SQL Error
> -SQL error code = -104
> -Token unknown - line 4, column 26
> -[
> SQL>
>
> Am I doing something obviously wrong?
>
> Thanks in advance for any answer.
>
> Regards,
> Jure
>
>
>
> ------------------------------------
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item on the main
> (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Yahoo! Groups Links
>