I want to create twodimensional array in PL/pgSQL.
I have found example like this: myarray1 INT[2][2]:=array[[NULL,NULL],[NULL,NULL]];
but in my case I don't know an array of the table when I create table because the data are read from select query. How I can declare dynamic array ?
I ask in another way. In Oracle I can declare:
CREATE OR REPLACE TYPE MY_TYPE AS OBJECT
(
var1 VARCHAR(20),
...
)
...
This is correspondent to RECORD is plpsql.
And then in Oracle I can declared
CREATE OR REPLACE TYPE MY_TYPE_MY_TYPES IS
table of MY_TYPE;
So I can store my result of select query in type of types which is just two-dimensional table. And I don't have to know number of rows returned by select query.
How I can acomplish this in plpsql ?
Thanks