Try OpenEdge Now
skip to main content
Java Open Clients
Using the Open Client Java OpenAPI to Directly Access the AppServer : Setting up parameters : Defining the schema for a temp-table parameter mapped to a java.sql.ResultSet : Adding the ProResultSetMetaDataImpl object as a temp-table parameter
 
Adding the ProResultSetMetaDataImpl object as a temp-table parameter
Add the ProResultSetMetaDataImpl object by passing it as a parameter of the addTable() or addTableHandle() method that you use to add the temp-table parameter to the ParamArray object. For more information, see TABLE andTABLE-HANDLE.
The following example adds a temp-table as an input parameter.

Example: OpenAPI fragment adding a temp-table parameter as an SQL ResultSet

// Create the ParamArray
ParamArray parms = new ParamArray(1);

// Set up the meta data
ProResultSetMetaDataImpl metaData1;
metaData1 = new ProResultSetMetaDataImpl(6);
metaData1.setFieldMetaData
             (1, "OrderNum", 0, Parameter.PRO_INTEGER);
metaData1. setFieldMetaData
             (2, "SalesRep", 0, Parameter.PRO_CHARACTER);
metaData1. setFieldMetaData
             (3, "OrderDate", 0, Parameter.PRO_DATE);
metaData1. setFieldMetaData
             (4, "ShipDate", 0, Parameter.PRO_DATE);
metaData1. setFieldMetaData
             (5, "TotalDollars", 0, Parameter.PRO_DECIMAL);
metaData1. setFieldMetaData
             (6, "OrderStatus", 0, Parameter.PRO_CHARACTER);

// Create result set for an input parameter
ResultSet rs = new ResultSet();
...
// Add the parameter to the ParamArray
parms.addTable(0, rs, ParamArrayMode.INPUT, metaData1);