Oracle8i Spatial User's Guide and Reference Release 8.1.5 A67295-01 |
|
If a query window does not already exist in the database, you must first insert it and create an index for it. The SDO_WINDOW functions and procedures are used to create temporary geometry objects to be used in comparisons with stored geometries. You can create query windows with any number of coordinates.
Because not all Oracle users may have insert privileges, the SDO_WINDOW package is not automatically installed when you install Spatial. This allows a DBA to control the schema under which these functions and procedures operate. Choose an Oracle user who has insert privilege and compile the SDO_WINDOW package under that user. For example, you could choose the mdsys Oracle user:
% sqlplus mdsys/password
SQL> @$ORACLE_HOME/md/admin/sdowin.sql SQL> @$ORACLE_HOME/md/admin/prvtwin.plb
This chapter contains descriptions of the window functions and procedures listed in Table 16-1.This chapter refers to the relational Spatial model only.
This function builds the window for the query and returns an SDO_GID that serves as a handle. The window is tessellated into hybrid tiles. Hybrid indexing is not recommended for the relational Spatial model.
SDO_WINDOW.BUILD_WINDOW(comp_name, layername, SDO_ETYPE, SDO_NUMTILES,
X1, Y1, [...Xn, Yn])
This function returns the SDO_GID of the new geometry. The data type is NUMBER.
This function inserts the coordinates into the <layername>_SDOGEOM table, tessellates the geometry (creates the index), and returns a unique SDO_GID corresponding to the geometry.
You do not need special privileges to execute this function. However, the user who compiles it does need appropriate privileges to read and write into the database.
When working with Spatial release 8.0.3 tables, the SDO_NUMTILES parameter indicates the number of tiles into which the window should be tessellated. For release 8.0.4 or later, the function reads that information automatically from the <layername>_SDOLAYER table.
SDO_WINDOW.BUILD_WINDOW_FIXED() function
This function builds the window for the query and returns an SDO_GID that serves as a handle. The window is tessellated into fixed-size tiles.
SDO_WINDOW.BUILD_WINDOW_FIXED (comp_name, layername, SDO_ETYPE, SDO_TILESIZE,
X1, Y1, [...Xn, Yn])
This function returns the SDO_GID of the new geometry. Data type is NUMBER.
This function inserts the coordinates into the <layername>_SDOGEOM table, tessellates the geometry (creates the index), and returns a unique SDO_GID corresponding to the geometry.
You do not need special privileges to execute this function. However, the user who compiles it does need appropriate privileges to read and write into the database.
Query SDO_LEVEL from the <layername>_SDOLAYER table to pass the correct SDO_TILE_SIZE value to this function.
None.
This procedure removes the four tables created in the layer for the query window.
SDO_WINDOW.CLEAN_WINDOW (layername);
layername |
Specifies the name of the window layer that must be removed. |
Typically, you would build a layer once, and then build multiple windows and perform multiple queries using that layer. After finishing all queries, you can execute the SDO_WINDOW.CLEAN_WINDOW() procedure to remove the tables.
SDO_WINDOW.CLEANUP_GID
This procedure removes the query window from the layer tables.
SDO_WINDOW.CLEANUP_GID (layername, SDO_GID);
layername |
Specifies the name of the window layer associated with the query window. |
SDO_GID |
Specifies the geometric object identifier of the query window. |
Typically, you would create a query layer once, and then build multiple query windows and perform multiple queries using that layer. The SDO_WINDOW.
procedure removes a single query window from the layer. Use this procedure to avoid the overhead of removing and re-creating the tables repeatedly.
CLEANUP_GID()
After finishing all queries, you can execute the SDO_WINDOW.CLEAN_WINDOW()
procedure to remove the tables.
SDO_WINDOW.CLEAN_WINDOW( )
This procedure creates the necessary tables that constitute a layer used for defining a query window.
SDO_WINDOW.CREATE_WINDOW_LAYER (layername, SDO_LEVEL, SDO_NUMTILES,
SDO_DIMNUM1, SDO_LB1, SDO_UB1, SDO_TOLERANCE1, SDO_DIMNAME1,
SDO_DIMNUM2, SDO_LB2, SDO_UB2, SDO_TOLERANCE2, SDO_DIMNAME2)
Because the <layername>_SDODIM table is initialized with the dimension and the bound information, only those queries that are in the same dimension should be queried against this layer. If you wish to issue a query with respect to a different dimension, you must create a new layer.
None.