Skip to content

Instantly share code, notes, and snippets.

@hugithordarson
Created November 25, 2011 08:59
Show Gist options
  • Save hugithordarson/1393084 to your computer and use it in GitHub Desktop.
Save hugithordarson/1393084 to your computer and use it in GitHub Desktop.
/**
* Call VERE_SP_3302 to get the transaction number for the operator
*
* @param username String username of the user that calls the procedure
* @param permno String permno of the vehicle
* @param startdate NSTimestamp date when the operator was registered
* @param enddate NSTimestamp date to set as last date of operator
* @param persidno String persidno of the operator to remove
* @param operserno int serial number of the operator( in the OPER table )
* @param mainoper String is the operator the main operator( 1 or 0 )
*/
private static int callOracleFunctionVERE_SP_3302( String username, String permno, NSTimestamp startdate, NSTimestamp enddate, String persidno, int operserno, String mainoper ) throws Exception {
NSTimestamp o_p_startdate = startdate; // o_p_startdate is used to lookup OPER( same as start date )
String statement = "{ ?=call VERE.VERE_SP_3302 ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) }";
NSMutableArray parameters = new NSMutableArray();
parameters.add( new OutParameter( 0 ) );
parameters.add( username );
parameters.add( usergroups );
parameters.add( errorcheck );
parameters.add( inlookupno );
parameters.add( changewarn );
parameters.add( confirmation );
parameters.add( transdate );
parameters.add( transno );
parameters.add( permno );
parameters.add( startdate );
parameters.add( enddate );
parameters.add( o_p_startdate );
parameters.add( persidno );
parameters.add( operserno );
parameters.add( p_repstation );
parameters.add( p_repsttype );
parameters.add( mainoper );
parameters.add( new OutParameter( "" ) );
parameters.add( new OutParameter( 0 ) );
parameters.add( new OutParameter( "" ) );
CallableStatement c = createCallableStatementWithParametersFromArray( statement, parameters );
c.executeQuery();
int transactionID = c.getInt( 1 );
c.close();
return transactionID;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment