I have a VARCHAR of numbers inside my stored procedure, these numbers are organized as arrays, I will show an example below:
{1,2,3,4,5,6,7,8,9},{1,2,3,4,5},{1,2,3},{9} -- This is a STRING
I want to do a FOR
loop to select every time a substring from this set between {}
and convert this to an array of integers.
So at first time inside my loop I will have:
{1,2,3,4,5,6,7,8,9}
So I will use array_to_string
to convert this to an integer[]
At second time I will have:
{1,2,3,4,5}
and keep going using array_to_string
Any tips? Careful, because unfortunately I'm using PostgreSQL 8.3!