voltdb drop procedure,create procedure

本文介绍了如何使用SQL命令删除已定义的存储过程及其对应的类文件,并详细阐述了通过类文件创建存储过程的过程,包括打包存储过程到Jar文件、加载到数据库及声明存储过程的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、删除预先定义的的procedure

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

1.1 uses remove classes to remove the corresponding class.

$ sqlcmd

1> DROP PROCEDURE FindCanceledReservations;
2> remove classes "*.FindCanceledReservations";
1.2 删除加载的class


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

二、利用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;

 

转载于:https://my.oschina.net/u/2308739/blog/665026

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值