Scalable Database Server, HiRDB Version 8 UAP Development Guide

[Contents][Index][Back][Next]

9.4.3 Parameter input/output mode mapping (Java stored procedures only)

This section explains the mapping of the SQL parameter input/output mode (IN, OUT, or INOUT) with Java stored procedures. You cannot specify a parameter input/output mode for a Java stored function.

For details about mapping, see the type mapping in the HiRDB Version 8 SQL Reference manual.

Figure 9-10 shows an example of parameter input/output mode mapping.

Figure 9-10 Example of parameter input/output mod mapping

[Figure]

Organization of this subsection
(1) IN parameter
(2) OUT or INPUT parameter

(1) IN parameter

For a parameter defined as an IN parameter with SQL, a Java program uses the corresponding data type as is.

Suppose that the IN parameter is defined as an INTEGER type with the CREATE PROCEDURE SQL statement. With a Java program, it is defined as the corresponding int type or java.lang.Integer type (param1 and jparam1 in Figure 9-10).

(2) OUT or INPUT parameter

For a parameter defined as an OUT or INOUT parameter with SQL, a Java program defines it as the array type of the corresponding data type. The OUT and INOUT parameters are implemented in this manner because a parameter is to be passed as a one-element array of the corresponding data type with the pointer representation method in the Java language.

Suppose that the OUT parameter is defined as SMALLINT type with the CREATE PROCEDURE SQL statement. With a Java program, it is defined as the array type of the corresponding short or java.long.Short type (param2 and jparam2; param3 and jparam3 in Figure 9-10). To return a value to the OUT or INOUT parameter, set the value at the beginning of the array (jparam2 and jparam3 in Figure 9-10).