Naming Convention

The classes, methods, attributes and arguments are named in camel case convention of the PL/SQL function, procedure, package, object and parameter name.

Example : Transfer Object

Object Type Specification : COL_OBJECT
/**
 * Object type with three fields of date, timestamp and varchar2.
 */
create or replace type col_object force as object (
  d           date,
  ts          timestamp,
  s           varchar2(100)
);
  • The PL/SQL object type COL_OBJECT is represented by the Java transfer object ColObject.
  • The attributes of the Java transfer object ColObject are :
    • java.sql.Date d;
    • java.sql.Timestamp ts;
    • java.lang.String s;

Example : Collection

Collection Table Type : TABLE_OF_COL_OBJECT
/**
 * Table of type col_object. 
 */
create or replace type table_of_col_object as table of col_object;
  • The PL/SQL collection TABLE_OF_COL_OBJECT of object type COL_OBJECT is represented by the Java list of transfers objects List<ColObject>.

Example : PL/SQL Procedure

PL/SQL Procedure : COLLECTIONS_OF_OBJECTS
create or replace procedure collections_of_objects
(
  i_delta_d         in    number,
  i_delta_ts        in    number,
  i_col_objects     in    table_of_col_object,
  o_col_objects     out   table_of_col_object
)
/**
 * Demonstration of calling a stored procedure with input of table of object elements. The elements are modified and returned as out put parameter.
 *
 * @param i_delta_d Offset is added to date value.
 * @param i_delta_ts Offset is added to timestamp value.
 * @param i_col_objects Input list of collection objects.
 * @param o_col_objects Output list of collection objects.
 */
is
begin
  -- initialize output collection
  o_col_objects := table_of_col_object();

  -- append elements to collection
  for i in 1..i_col_objects.count loop
    o_col_objects.extend();
    o_col_objects(i) := col_object(i_col_objects(i).d + i_delta_d + i, i_col_objects(i).ts + i_delta_ts + i, i_col_objects(i).s || ' - ' || DBMS_RANDOM.string('A',10));
  end loop;
end collections_of_objects;
  • The Java representation of the PL/SQL procedure COLLECTIONS_OF_OBJECTS is :
    • Implementation Java class : CollectionsOfObjectsServiceImpl
    • Service interface : CollectionsOfObjectsService
    • Factory service getter method : getCollectionsOfObjectsService()
    • Parameter : i_delta_d => Integer iDeltaD (Numeric Conversion Model : int-double/Integer-Double)
    • Parameter : i_delta_ts => java.sql.Timestamp iDeltaTs
    • Parameter : i_col_objects => List<ColObject> iColObjects
    • Parameter : o_col_objects => Java method return value List<ColObject>