Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 07E839FB4FA for ; Tue, 15 May 2007 01:51:29 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 39284-08 for ; Tue, 15 May 2007 01:51:23 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from bay0-omc3-s24.bay0.hotmail.com (bay0-omc3-s24.bay0.hotmail.com [65.54.246.224]) by postgresql.org (Postfix) with ESMTP id 204E89FB4F5 for ; Tue, 15 May 2007 01:51:22 -0300 (ADT) Received: from hotmail.com ([64.4.53.74]) by bay0-omc3-s24.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Mon, 14 May 2007 21:51:21 -0700 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 14 May 2007 21:51:21 -0700 Message-ID: Received: from 69.45.64.93 by by19fd.bay19.hotmail.msn.com with HTTP; Tue, 15 May 2007 04:51:17 GMT X-Originating-IP: [203.125.54.38] X-Originating-Email: [ntuser155@hotmail.com] X-Sender: ntuser155@hotmail.com From: "Nemo Terry" To: pgsql-sql@postgresql.org Subject: How to process inverted comma in "EXECUTE 'insert into xxx values(...)'; "? Date: Tue, 15 May 2007 12:51:17 +0800 Mime-Version: 1.0 Content-Type: text/plain; charset=gb2312; format=flowed X-OriginalArrivalTime: 15 May 2007 04:51:21.0664 (UTC) FILETIME=[AEECBC00:01C796AC] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.753 tagged_above=0 required=5 tests=AWL=-0.156, BAYES_50=0.001, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708, MSGID_FROM_MTA_HEADER=0 X-Spam-Level: * X-Archive-Number: 200705/116 X-Sequence-Number: 28396 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