Re: plpgsql Integer Concat To String - Mailing list pgsql-bugs

From Rich Hall
Subject Re: plpgsql Integer Concat To String
Date
Msg-id 3FE31D03.3090706@micropat.com
Whole thread Raw
In response to plpgsql Integer Concat To String  (Puneet Paul <paulptech@yahoo.com>)
List pgsql-bugs
Convert  "counter" into a VARCHAR and coincatinate that to IdSet using
th || operator.
You cannot concatinate data of differing TYPEs.

Rick

Puneet Paul wrote:

>Hi,
>
>I want to concatenate a it counter to a string in a
>loop in plpgsql.
>DECLARE
>counter integer := 1;
>IdSet char : = 'UniqueId'
>IdForEachRun varchar;
>BEGIN
>
>IdForEachRun := IdSet || counter;(PROBLEM HERE)
>--Or IdForEachRun := IdSet + counter;(PROBLEM HERE)
>While condition LOOP
>
>Insert into Table values(IdForEachRun, ......)
>
>
>
>counter := counter + 1;
>IdForEachRun := IdSet || counter;(PROBLEM HERE)
>--Or IdForEachRun := IdSet + counter;(PROBLEM HERE)
>END LOOP
>
>END
>Language 'plpgsql'
>
>Thanks in advance.
>
>Paul
>
>
>__________________________________
>Do you Yahoo!?
>Protect your identity with Yahoo! Mail AddressGuard
>http://antispam.yahoo.com/whatsnewfree
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>               http://www.postgresql.org/docs/faqs/FAQ.html
>
>
>

--
------------------------------------------------------------------------
A Message from MicroPatent® LLC

MicroPatent now offers searchable .PDF patents!  Save time and improve your workflow efficiencies with these
convenient,easy-to-review documents.  For more information, go to
http://www.micropat.com/0/searchable_pdf/searchable_pdf.html.

Richard Hall
Database Programmer
MicroPatent LLC
250 Dodge Avenue
East Haven, CT  06512
T:  <Phone Number>, x 3321
F:  <Fax Number>
S:  <Toll Free Number>
rhall@micropat.com
www.micropat.com

MicroPatent is an Information Holdings Inc. company (NYSE: IHI).

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: [GENERAL] CASE in where statement. BUG ??
Next
From: "PostgreSQL Bugs List"
Date:
Subject: BUG #1020: Timestamp representation printed by PostgreSQL are invalid