HOW TO
When building an application with Oracle, which executes SQL statements containing dynamic predicate filters, developers must incorporate the binding of predicate values (verses literal strings) to ensure that the performance and scalability of the system is not impacted.
Without binding the predicate values in a SQL statement, each execution of the statement will be parsed by the database. Frequent parsing can quickly lead to poor performance and the potential of the application not being able to scale and support a large number of concurrent users.
Instructions provided describe how to bind the literal values for a SQL statement using the st_within relational operator and the constructor operator st_polyfromtext.
Code:
SQL> VARIABLE poly_shp VARCHAR2(512)
SQL> VARIABLE srid NUMBER
Code:
SQL> EXECUTE :poly_shp := 'POLYGON (( 1505000 -1072000, 1505000 -1076000, 1512500 -1076000, 1512500 -1072000, 1505000 -1072000))';
PL/SQL procedure successfully completed.
Code:
SQL> EXECUTE :srid := 16;
PL/SQL procedure successfully completed.
Code:
SQL> SELECT count(*) FROM street
2 WHERE sde.st_within(shape,sde.st_polyfromtext(:poly_shp, :srid)) = 1;
Get help from ArcGIS experts
Download the Esri Support App