DECLARE v_days_of_week BOOLEAN[7];
-- This line returns NULL
PRINT v_days_of_week[2];
-- This line causes Kernel error: 0x71000. unexpected token v_days_of_week
SET v_days_of_week[2] = TRUE;
-- This line causes Kernel error: 0xa000. "Getting expression from value of ARRAY type" is not supported.
SET v_days_of_week = ARRAY[false,true,false,false,false,false,false];
I'm wondering if it is possible to retrieve an array field from a table and store it in a variable. All of the examples for Array functions in the documentation use literals for the array values (and none of them stores the array in a variable). I'm hoping that I can retrieve an array from a table and then loop through the array in a stored procedure. I'm also hoping that I can put the value of another variable into an element of an array.
My workaround thus far is to concatenate the elements of the array into a comma-delimited string and use the List... functions to access the elements. I'm wondering if there is another (better) way to do this.