Re: plpgsql Integer Concat To String

From: Rich Hall <rhall(at)micropat(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: plpgsql Integer Concat To String
Date: 2003-12-19 15:45:07
Message-ID: 3FE31D03.3090706@micropat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)micropat(dot)com
www.micropat.com

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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PostgreSQL Bugs List 2003-12-19 15:45:27 BUG #1020: Timestamp representation printed by PostgreSQL are invalid
Previous Message Tom Lane 2003-12-19 15:40:39 Re: [GENERAL] CASE in where statement. BUG ??