Subject | RE: [firebird-support] Declare and use array datatype in stored procedures |
---|---|
Author | Hans |
Post date | 2012-12-30T18:29:45Z |
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
-----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