[postgis-users] How to excute dynamically a generated SQL command?
Tom Glancy
Tom.Glancy at dnr.state.mn.us
Sat Jan 3 18:15:35 PST 2009
It looks like there is a parenthesis missing - the closing parenthesis for VALUES.
maybe try:
sSql='INSERT INTO hm_raster.hm_airphotos( file_ext, airphoto) VALUES
('.tif', lo_import( E''C:\\HM\\Data\\Flightmap.tif''));';
Tom
---------------------------------------
Tom Glancy
Ecological Services Division IT Supervisor
tom.glancy at dnr.state.mn.us
651-259-5097
Minnesota Department of Natural Resources
500 Lafayette Road - Box 25
St. Paul, MN 55155-4025
---------------------------------------
>>> "John Zhang" <johnzhang06 at gmail.com> 01/03/09 8:00 PM >>>
Hi the list,
Referring to the PostgreSQL 8.3 documentation " 38.5.4. Executing Dynamic
Commands ", the command for executing a dynamic command is:
EXECUTE command-string [ INTO [STRICT] target ];
I am to execute an sql statement created dynamically, which is represented
in a variable sSql.
Here is an example:
sSql='INSERT INTO hm_raster.hm_airphotos( file_ext, airphoto) VALUES
('.tif', lo_import( E''C:\\HM\\Data\\Flightmap.tif'');';
EXECUTE sSQL;
It raises the error as:
ERROR: syntax error at end of input
LINE 1: ...E'C:\\HM\\Data\\Flightmap.tif')
^
I would appreciate a lot if you offer your input. Thanks a lot.
John
More information about the postgis-users
mailing list