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

Поиск
Список
Период
Сортировка
От Nemo Terry
Тема How to process inverted comma in "EXECUTE 'insert into xxx values(...)';"?
Дата
Msg-id BAY19-F2416AC2716765516AB4824F53D0@phx.gbl
обсуждение исходный текст
Ответы Re: How to process inverted comma in "EXECUTE 'insert into xxx values(...)';"?  ("Rodrigo De León" <rdeleonp@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Bryce Nesbitt
Дата:
Сообщение: Re: Doing a conditional aggregate (e.g. count(*) if x=y) in postgres?
Следующее
От: "Rodrigo De León"
Дата:
Сообщение: Re: How to process inverted comma in "EXECUTE 'insert into xxx values(...)';"?