Stored Procedures in der VoltDB

Mit Java

import org.voltdb.*;

public class <class_name> extends VoltProcedure {
  public final SQLStmt <func_name> = new SQLStmt(
    " SELECT *"
    + " FROM foo WHERE bar=?"
    + " ORDER BY whatever ASC;" );
    
  public VoltTable[] run(int bar_value)
    throws VoltAbortException {
    voltQueueSQL( <func_name>, bar_value );
    return voltExecuteSQL();
  }
}
javac -cp "$CLASSPATH:/opt/voltdb/voltdb/*"  <name>.java
jar cvf <name>.jar *.class
sqlcmd --user=admin --password=<pwd>
1> load classes <name>.jar;
sqlcmd --user=admin --password=<pwd>
1> CREATE PROCEDURE FROM CLASS <class_name>;