How to process inverted comma in "EXECUTE 'insert into xxx values(...)'; "?

From: "Nemo Terry" <ntuser155(at)hotmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: How to process inverted comma in "EXECUTE 'insert into xxx values(...)'; "?
Date: 2007-05-15 04:51:17
Message-ID: BAY19-F2416AC2716765516AB4824F53D0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Look at this problem:
when
execute 'insert into lse_installations values(' || ''''||obj_id||'''' || ',' || ''''||div||'''' || ',' || ''''||sub||'''' || ',' || ''''||obj_type||'''' || ',' || ''''||obj_name||'''' || ',' || ''''||pstcd||'''' || ',' || ''''||rdcd||'''' || ',' || ''''||blkno||'''' || ',' || ''''||vldunt||'''' || ','|| cenlat || ',' || cenlon || ')';
because obj_name from another table has value like this:S'pore High Polymer.
Following error raises:
ERROR: syntax error at or near "pore"
SQL state: 42601
Context: PL/pgSQL function "lse_installations" line 64 at execute statement

So how to process the single inverted comma in char variable?It makes me so desperate.

_________________________________________________________________
与世界各地的朋友进行交流,免费下载 Live Messenger; http://get.live.com/messenger/overview

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rodrigo De León 2007-05-15 06:25:25 Re: How to process inverted comma in "EXECUTE 'insert into xxx values(...)'; "?
Previous Message Bryce Nesbitt 2007-05-14 23:48:06 Re: Doing a conditional aggregate (e.g. count(*) if x=y) in postgres?