[postgis-users] envelope
Nicolas Ribot
nicky666 at gmail.com
Mon Jun 20 08:22:17 PDT 2005
> Hello all,
>
> Trying to write a stored procedure that returns the envelope.
>
> Code follows:
>
> sSQLExp:= 'SELECT the_geom FROM ' || quote_ident(stable) || ' WHERE ' ||
> quote_ident(sfield) || ' = ' || quote_literal(svalue);
> RAISE NOTICE 'sSQLExp = %', sSQLExp;
> OPEN pTempCursor FOR EXECUTE sSQLExp;
> LOOP
> FETCH pTempCursor INTO pFeatureGeometry;
> EXIT WHEN NOT FOUND;
> sSQL:= 'SELECT envelope(' || sSQLExp || ') FROM ' ||
> quote_ident(stable);
> RAISE NOTICE 'sSQL = %', sSQL;
>
> OPEN pCursor FOR EXECUTE sSQL;
> LOOP
> FETCH pCursor INTO pBoundBox;
> EXIT WHEN NOT FOUND;
> END LOOP;
> END LOOP;
> CLOSE pCursor;
> CLOSE pTempCursor;
>
> ************************************************************
> THE SECOND NOTICE STATEMENT SHOWS:
> sSQL = SELECT envelope(SELECT the_geom FROM subdiv WHERE subdivname =
> 'HIGHLANDER ESTATES') FROM subdiv
>
> GET THE FOLLOWING ERROR:
>
> SYNTAX ERROR AT OR NEAR "SELECT" AT CHARACTER 17; POINTS TO THE 'S' IN THE
> SECOND SELECT STATEMENT.
> SELECT ENVELOPE(SELECT.....
>
Hello,
I tried a similar query and it appears that you should put your inner
select into parenthesis, something like:
SELECT envelope((SELECT the_geom FROM subdiv WHERE subdivname =
'HIGHLANDER ESTATES')) FROM subdiv.
Nicolas
More information about the postgis-users
mailing list