voltdb drop procedure,create procedure

1、刪除預先定義的的procedure

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

1.1 uses remove classes to remove the corresponding class.

$ sqlcmdthis

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

1.2 刪除加載的class


3> remove classes  com.hpe.procedures.Insertprocedure_service_t;
Command succeeded.
 spa

2、利用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: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;
相關文章
相關標籤/搜索