Subject Arrays
Author lobizoom1
Hi everybody,

I have 2 problems and need help. I use FB 2.5.1 and FlameRobin 0.9.3.2210 Unicode.

create domain UINT16 as smallint
default 0
not null
check (value >= 0);

is already defined into database.


First problem :
create table TestTable
(
Number UINT16,
ValuesArr1 UINT16 [0:29]
);
When I tried to create TestTable, I got error :
SQL Error Code: -104
Token unknown -line 4, column 22 [

When I change the array declaration, all goes well.
create table TestTable
(
Number UINT16,
ValuesArr1 smallint [0:29]
);

Is there any restriction on using domain when creating array columns ? I didn't find anywhere (EmbedSQL, LangRef, etc.) such restriction. Can anybody learn me what is wrong ?

Second problem :

set term # ;

create procedure spFillData
as
declare i smallint = 0;
declare v smallint = 100;
declare c based on TestTable.ValuesArr1;
begin
while (i < 30) do
begin
c[i] = v + 1;
v = v + 1;
i = i + 1;
end
insert into TestTable values (:i, :c);
end #

set term ; #

This simple procedure would help me to test inserting data in this table. And then I got to problems.
Impossible to create procedure because " based on " is not recognized.
I search on FB FAQ and forum how to resolve array problem and found nothing.

Can anybody help me to insert and update data into array columns with PSQL ?


Zoe