Re: varchar for loops possible?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "J(dot)V(dot)" <jvsrvcs(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: varchar for loops possible?
Date: 2012-05-18 20:40:07
Message-ID: 1274.1337373607@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"J.V." <jvsrvcs(at)gmail(dot)com> writes:
> for tmp_var in select distinct(value) from mytable where
> value2='literal'
> tmp_var has to be in ' ' ticks or will not work. it is failing on the
> first FOR statment stating: "invalid input syntax for integer:
> "some_distinct_value".

Um, how do you have tmp_var declared? plpgsql seems to be acting
as though it's an integer variable, which is not what you need if
"value" is a varchar.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jon Smark 2012-05-18 21:06:03 Re: Fetching multiple rows in single round trip
Previous Message J.V. 2012-05-18 20:30:44 varchar for loops possible?