<P>Hello all,<BR>
<BR>
Trying to write a stored procedure that returns the envelope.<BR>
<BR>
Code follows:<BR>
<BR>
sSQLExp:= 'SELECT the_geom FROM ' || quote_ident(stable) || ' WHERE ' || quote_ident(sfield) || ' = ' || quote_literal(svalue);<BR>
RAISE NOTICE 'sSQLExp = %', sSQLExp;<BR>
OPEN pTempCursor FOR EXECUTE sSQLExp;<BR>
LOOP<BR>
FETCH pTempCursor INTO pFeatureGeometry;<BR>
EXIT WHEN NOT FOUND;<BR>
sSQL:= 'SELECT envelope(' || sSQLExp || ') FROM ' || quote_ident(stable);<BR>
RAISE NOTICE 'sSQL = %', sSQL;</P>
<P> OPEN pCursor FOR EXECUTE sSQL;<BR>
LOOP<BR>
FETCH pCursor INTO pBoundBox;<BR>
EXIT WHEN NOT FOUND; <BR>
END LOOP;<BR>
END LOOP;<BR>
CLOSE pCursor;<BR>
CLOSE pTempCursor;<BR>
<BR>
************************************************************<BR>
THE SECOND NOTICE STATEMENT SHOWS:<BR>
sSQL = SELECT envelope(SELECT the_geom FROM subdiv WHERE subdivname = 'HIGHLANDER ESTATES') FROM subdiv<BR>
<BR>
GET THE FOLLOWING ERROR:<BR>
<BR>
SYNTAX ERROR AT OR NEAR "SELECT" AT CHARACTER 17; POINTS TO THE 'S' IN THE SECOND SELECT STATEMENT.<BR>
SELECT ENVELOPE(SELECT.....<BR>
<BR>
ANY IDEAS????<BR>
<BR>
<BR>
</P><BR>