Iterating over an varchar array?

Started by Marcos Iuatoalmost 22 years ago2 messagesgeneral
Jump to latest
#1Marcos Iuato
iuato@samurai.com.br

I am trying to iterate over an varchar array using plpgsql but i get the
this error:

Error: missing .. at the end of SQL expression

My Table:

TABLE1(
Cars VARCHAR[]
)

My Code

Declare
mycars varchar[];
car varchar;
Begin
For car in SELECT cars from table1 LOOP
RAISE Notice "CAR: %", car
END Loop;
END;

Resume, i have a column with a list of varchar type and i would like to
iterate over this array, is this possible?

Thanks,

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Marcos Iuato (#1)
Re: Iterating over an varchar array?

"Marcos Iuato" <iuato@samurai.com.br> writes:

Declare
mycars varchar[];
car varchar;
Begin
For car in SELECT cars from table1 LOOP

I think the iteration variable for a FOR ... IN SELECT has to be a
record or rowtype variable.

regards, tom lane