Example: Array data type in Java (JDBC) procedure

An example of a Java™ routine using the array data type.

The following example illustrates the skeleton of a Java routine with an IN and an OUT parameter of the array data type.
CREATE TYPE phonenumbers AS VARCHAR(20) ARRAY[10] %
CREATE PROCEDURE javaproc( IN in1 phonenumbers,
                           OUT out1 phonenumbers)
  LANGUAGE java
  PARAMETER STYLE java 
  FENCED THREADSAFE
  EXTERNAL NAME 'myjar:stpclass.javastp' %
import java.sql.Array;
 
public static void javaproc(Array input, Array[] output)
{
output[0] = input;
}