A script-enabled browser is required for this page to function properly.

ORA_JAVA.SET_java_type_ARRAY_ELEMENT built-in procedure

This procedure changes the value of a given element in a given array of the specified Java type to a given value.

Syntax


PROCEDURE ORA_JAVA.SET_OBJECT_ARRAY_ELEMENT (
  arr IN ORA_JAVA.JARRAY,
  pos IN PLS_INTEGER,
  value IN ORA_JAVA.JOBJECT);

PROCEDURE ORA_JAVA.SET_BYTE_ARRAY_ELEMENT (
  arr IN ORA_JAVA.JARRAY,
  pos IN PLS_INTEGER,
  value IN PLS_INTEGER);

PROCEDURE ORA_JAVA.SET_CHAR_ARRAY_ELEMENT (
  arr IN ORA_JAVA.JARRAY,
  pos IN PLS_INTEGER,
  value IN PLS_INTEGER);

PROCEDURE ORA_JAVA.SET_SHORT_ARRAY_ELEMENT (
  arr IN ORA_JAVA.JARRAY,
  pos IN PLS_INTEGER,
  value IN PLS_INTEGER);

PROCEDURE ORA_JAVA.SET_INT_ARRAY_ELEMENT (
  arr IN ORA_JAVA.JARRAY,
  pos IN PLS_INTEGER,
  value IN NUMBER);

PROCEDURE ORA_JAVA.SET_LONG_ARRAY_ELEMENT (
  arr IN ORA_JAVA.JARRAY,
  pos IN PLS_INTEGER, 
  value IN NUMBER);

PROCEDURE ORA_JAVA.SET_FLOAT_ARRAY_ELEMENT (
  arr IN ORA_JAVA.JARRAY,
  pos IN PLS_INTEGER,
  value IN NUMBER);

PROCEDURE ORA_JAVA.SET_DOUBLE_ARRAY_ELEMENT (
  arr IN ORA_JAVA.JARRAY,
  pos IN PLS_INTEGER,
  value IN NUMBER);

PROCEDURE ORA_JAVA.SET_STRING_ARRAY_ELEMENT (
  arr IN ORA_JAVA.JARRAY,
  pos IN PLS_INTEGER,
  value IN VARCHAR2);

PROCEDURE ORA_JAVA.SET_BOOLEAN_ARRAY_ELEMENT (
  arr IN ORA_JAVA.JARRAY,
  pos IN PLS_INTEGER,
  value IN BOOLEAN);

Parameters

Description

arr

A valid array of the specified type. The actual parameter is the array of type ORA_JAVA.JARRAY

pos

Position of the element in the array to be replaced. Note that the position of the first element is always 0. For example, in an array of size 3, the positions of the elements are 0, 1, and 2.

value

New value of the specified type to replace the array element.

Usage notes

See Working with Arrays for additional information.

Examples


/*
 ** Example of changing 3 values of an array of data type object.
 */
PROCEDURE set_object_array IS
  arr ORA_JAVA.JOBJECT;
  obj ORA_JAVA.JOBJECT;
BEGIN
  arr := ORA_JAVA.NEW_OBJECT_ARRAY(3, 'myapp.foo');
  ORA_JAVA.SET_OBJECT_ARRAY_ELEMENT(arr, 0, foo.new('obj1'));
  ORA_JAVA.SET_OBJECT_ARRAY_ELEMENT(arr, 1, foo.new('obj2'));
  ORA_JAVA.SET_OBJECT_ARRAY_ELEMENT(arr, 2, foo.new('obj3'));
  ...
END;


/*
 ** Example of changing the value of an array of data type char.
 */
PROCEDURE set_char_array IS
  arr ORA_JAVA.JOBJECT;
BEGIN
  arr := ORA_JAVA.NEW_CHAR_ARRAY(1);
  ORA_JAVA.SET_CHAR_ARRAY_ELEMENT(arr, 0, 2);
  ...
END;

See also

Working with Arrays

ORA_JAVA.NEW_java_type_ARRAY

ORA_JAVA.GET_java_type_ARRAY_ELEMENT

ORA_JAVA.GET_ARRAY_LENGTH