Subject | Declare and use array datatype in stored procedures |
---|---|
Author | jb303@ymail.com |
Post date | 2012-12-30T16:10:04Z |
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
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