java代码创建触发器 创建触发器例题

java中怎么创建mysql的触发器2.在Java程序里创建触发器
String sql=+" CREATE TRIGGER catefiles_trigger AFTER INSERT ON catefiles FOR EACH ROW"
+" begin"
+" declare scannum int;"
+" set scannum = (select num from est_client_catescan_status where"
+" cateid=new.cateId and taskid=new.taskId and clientid=new.clientId);"
+" if(scannum=0) then"
+" update catescan_status set num=scannum+1where cateid=new.cateId and taskid=new.taskId and clientid=new.clientId;"
+" else"
+" insert catescan_status(cateid,num,status,taskid,clientid) values(new.cateId,1,0,new.taskid,new.clientId);"
+" end if;"
+" end";
Connection con = DbConnectionManager.getConnection();
PreparedStatementpstmt = con.prepareStatement(sql);
pstmt.execute();
用Java代码创建Oracle触发器要怎么实现create or replace and compile java source named TestClass as
public class TestClass
{
【java代码创建触发器 创建触发器例题】public static String getName(String name) {
String name = "xoxo";
return name " with TTTT";
}
}
然后在触发器中调用:
create or replace trigger TRI_TEST before delete or update or insert on TABLENAME for each row
declare name varchar2(20);
begin
if inserting then
FUNCTION getName( who VARCHAR2 ) RETURN VARCHAR2 IS LANGUAGE JAVA NAME TestClass.getName(java.lang.String) return String';
end if;
end;
请问一下怎么做一个定时触发器啊,我想要用java程序中做一个定时触发器,请各位高手指教,最好有源代码final Timer machinetimer = new Timer();
machinetimer.schedule(new TimerTask() {
@Override
public void run() {
//定时执行的方法
XXXX();
}
}, 1000, 1000);
第一个1000代表系统运行后,这个定时任务多久会执行 。
第二个 1000代表每次执行间隔时间
如果有不懂的可以再来问我
如何用java创建触发器java是应用程序,可以通过jdbc接口调用触发器:
create or replace trigger bj_customer
before update on customer
for each row
begin
update order set
cu_no=:new.cu_no , 
cu_name=:new.cu_name,
cu_address=:new.cu_addess,
where cu_no=:old.cu_no;
end;
调用executeUpdate方法即可
关于java代码创建触发器和创建触发器例题的介绍到此就结束了 , 不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息 , 记得收藏关注本站 。

    推荐阅读