How to process inverted comma in "EXECUTE 'insert into xxx values(...)';"? - Mailing list pgsql-sql

From Nemo Terry
Subject How to process inverted comma in "EXECUTE 'insert into xxx values(...)';"?
Date
Msg-id BAY19-F2416AC2716765516AB4824F53D0@phx.gbl
Whole thread Raw
Responses Re: How to process inverted comma in "EXECUTE 'insert into xxx values(...)';"?  ("Rodrigo De León" <rdeleonp@gmail.com>)
List 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 



pgsql-sql by date:

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