CREATE LIBRARY statement

Identify an external library, and deploy the functions in that library.

This example uses the library file Functions.class, which is included with Event Stream Processor. If you are creating a library within ESP Studio using an external file, the CLASSPATH variable should contain the library file source directory. If you are not using ESP Studio, you can edit the project configuration file (.ccr) to set the Java-classpath option to the library file source directory.

The example begins with the CREATE LIBRARY statement, which creates a Java-language library named SC1 from the Functions.class file.

CREATE LIBRARY SC1 LANGUAGE java FROM 'Functions' (
    integer intdiffj(integer, integer);
    string  stringaddj (string, string); 
); 

The example creates two schemas named Schema1 and OutSchema. The example then creates an input window named win1 that references Schema1, and an output window named OutWin that references OutSchema. Manually load data into win1.

CREATE INPUT WINDOW win1 SCHEMA Schema1 
	PRIMARY KEY (fcol5)
	KEEP ALL
;

CREATE OUTPUT WINDOW OutWin Schema OutSchema
PRIMARY KEY  DEDUCED
AS 
	SELECT  a.intcol1, 
	 a.intcol2,
	 SC1.intdiffj (a.intcol1, a.intcol2)as library_int, 
	 a.fcol5, 
	 a.stringcol1, 
	 a.stringcol2, 
	 SC1.stringaddj(a.stringcol1, a.stringcol2) as library_string
	FROM win1 a 
;