Tuesday, 22 April 2014

Usage of Record Type in Callable Statement

write below code under processFormRequest  based on your conditions.we can process record types using below Process

Import statement:
import oracle.jdbc.driver.OracleCallableStatement;
import oracle.sql.ARRAY;
import oracle.sql.ArrayDescriptor;
 import java.sql.SQLException;

String str[] = new String[30];

       for(int i = 0; i < 10; i++)

       try

     {

        str[i] = i;
      }
      catch(Exception e)

    {
          str[i] = null;
    }

  try
 {

   ArrayDescriptor segvaldesc = ArrayDescriptor.createDescriptor("SEGMENT_VALUES", connection);

   ARRAY segval = new ARRAY(segvaldesc, connection, str);

  OracleCallableStatement ocs = (OracleCallableStatement)connection.prepareCall("Begin  
   XXHR_SIT_VALIDATION_PKG.VALIDATE_RECORD 
  (p_sit_code=>:1,p_segment=>:2,p_person_id=>:3,p_employee_id=>:4,p_message=>:5); end;");

  ocs.setString(1, s_struc_code);
  ocs.setARRAY(2, segval);
  ocs.setString(3, v_person_id);
  ocs.setString(4, v_emp_id);
  ocs.registerOutParameter(5, 12);
  ocs.execute();

  v_message = ocs.getString(5);
  ocs.close();
 }
catch(SQLException sqlexception)
{
throw new OAException("Error " + sqlexception.getMessage(), (byte)2);
}

No comments:

Post a Comment