The following example removes the definition of the FindCanceledReservations stored procedure, thensql
$ sqlcmdthis
1> DROP PROCEDURE FindCanceledReservations; 2> remove classes "*.FindCanceledReservations";
3> remove classes com.hpe.procedures.Insertprocedure_service_t;
Command succeeded.
spa
$ jar cvf storedprocs.jar *.class
Once you package the stored procedures into a Jar file, you can then load them into the database using the sqlcmd load classes directive. For example:code
$ sqlcmd 1> load classes storedprocs.jar;
Finally, we can declare the stored procedure in our schema, in much the same way simple stored procedures are declared. But this time we use the CREATE PROCEDURE FROM CLASS statement, specifying the class name rather than the SQL query.ci
We can also partition the procedure on the People table, since all of the queries are constrained to a specific value of State_num, the partitioning column. Here is the statementrem
we add to the schema.cmd
CREATE PROCEDURE PARTITION ON TABLE people COLUMN state_num FROM CLASS UpdatePeople;
Notice that you do not need to specify the name of the procedure after "CREATE PROCEDURE" because, unlike simple stored procedures, the CREATE PROCEDURE FROM CLASS statement takes the procedure name from the name of the class; in this case, UpdatePeople.it
Go ahead and enter the CREATE PROCEDURE FROM CLASS statement at the sqlcmd prompt to bring your database up to date:io
$ sqlcmd 1> CREATE PROCEDURE 2> PARTITION ON TABLE people COLUMN state_num 3> FROM CLASS UpdatePeople;