How to excute dynamically a generated SQL command? - Mailing list pgsql-sql

From John Zhang
Subject How to excute dynamically a generated SQL command?
Date
Msg-id 618950b80901031757l15109658kdae1cdb0814d33fc@mail.gmail.com
Whole thread Raw
Responses Re: How to excute dynamically a generated SQL command?
List pgsql-sql
Hi the list,<br /><br />Referring to the PostgreSQL 8.3 documentation " 38.5.4. Executing Dynamic Commands ", the
commandfor executing a dynamic command is: <br />EXECUTE command-string [ INTO [STRICT] target ];<br /><br /><br />I am
toexecute an sql statement created dynamically, which is represented in a variable sSql. <br />Here is an example:<br
/>sSql='INSERTINTO hm_raster.hm_airphotos( file_ext, airphoto) VALUES ('.tif',  lo_import(
E''C:\\HM\\Data\\Flightmap.tif'');';<br/> EXECUTE sSQL;<br /><br />It raises the error as:<br />ERROR:  syntax error at
endof input<br />LINE 1: ...E'C:\\HM\\Data\\Flightmap.tif')<br
/>                                                         ^<br /><br />I would appreciate a lot if you offer your
input.Thanks a lot.<br /><br />John<br /> 

pgsql-sql by date:

Previous
From: Steve Midgley
Date:
Subject: Re: Question on Escape-string
Next
From: "sergey kapustin"
Date:
Subject: EXECUTE with a prepared plan and NULL