Re: varchar for loops possible? - Mailing list pgsql-general

From Tom Lane
Subject Re: varchar for loops possible?
Date
Msg-id 1274.1337373607@sss.pgh.pa.us
Whole thread Raw
In response to varchar for loops possible?  ("J.V." <jvsrvcs@gmail.com>)
Responses Re: varchar for loops possible?
List pgsql-general
"J.V." <jvsrvcs@gmail.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

pgsql-general by date:

Previous
From: "J.V."
Date:
Subject: varchar for loops possible?
Next
From: Jon Smark
Date:
Subject: Re: Fetching multiple rows in single round trip