voltdb drop procedure,create procedure

一、删除预先定义的的procedure

The following example removes the definition of the FindCanceledReservations stored procedure, then

uses remove classes to remove the corresponding class.

$ sqlcmd

1> DROP PROCEDURE FindCanceledReservations;
2> remove classes "*.FindCanceledReservations";


二、利用class 文件 创建存储过程

$ 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:

$ 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. 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 statement

we add to the schema.

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.

Go ahead and enter the CREATE PROCEDURE FROM CLASS statement at the sqlcmd prompt to bring

your database up to date:

$ sqlcmd
1> CREATE PROCEDURE
2> PARTITION ON TABLE people COLUMN state_num
3> FROM CLASS UpdatePeople;


你可能感兴趣的:(procedure,procedure,create,drop,VoltDB)