6.95 SDO_NET.REGISTER_CONSTRAINT

Format

SDO_NET.REGISTER_CONSTRAINT(      
  constraint_name IN VARCHAR2,      
  class_name      IN VARCHAR2,      
  directory_name  IN VARCHAR2,      
  description     IN VARCHAR2);

Description

Loads the compiled Java code for the specified network constraint into the Java class repository in the database, and loads the class name into the CLASS column of the USER_SDO_NETWORK_CONSTRAINTS view (described in xxx_SDO_NETWORK_CONSTRAINTS Views).

Parameters

constraint_name

Name of the network constraint.

class_name

Fully qualified name (including the name of the package) of the class that implements the network constraint.

directory_name

Name of the directory object (created using the SQL statement CREATE DIRECTORY) that identifies the location of the class file created when you compiled the network constraint.

description

Description of the network constraint.

Usage Notes

Before you call this procedure, you must insert a row into the USER_SDO_NETWORK_CONSTRAINTS view, compile the code for the Java class that implements the network constraint, and use the CREATE DIRECTORY statement to create a directory object identifying the location of the compiled class. For more information about network constraints, see Network Constraints.

To delete the row for the constraint from the USER_SDO_NETWORK_CONSTRAINTS view and thus disable the constraint, use the SDO_NET.DEREGISTER_CONSTRAINT procedure.

Examples

The following example registers a network constraint named GivenProhibitedTurn.

-- Set up the network constraint.
REM
REM Create the geor_dir on the file system first.
REM
-- Connect as SYSTEM.
DECLARE 
  -- This is the directory that contains the CLASS file generated when you
  -- compiled the network constraint.
  geor_dir varchar2(1000) := 'C:\my_data\files81\PROTOTYPES\NETWORK_CONSTRAINT\PLSQL_EXAMPLE';
BEGIN 
  EXECUTE IMMEDIATE 'CREATE OR REPLACE DIRECTORY work_dir AS''' || geor_dir || ''''; 
END;
/
GRANT read,write on directory work_dir to net_con;
 
-- Connect as the user that will register the constraint. 
 
REM
REM Compile GivenProhibitedTurn before you register the constraint.
REM
BEGIN
  SDO_NET.REGISTER_CONSTRAINT('GivenProhibitedTurn', 
     'com/network/constraints/ProhibitedTurn',
     'WORK_DIR', 'This is a network constraint that '||
     'prohibits certain turns');
 
END;
/