简单存储过程:从表B中查询出数据插入A中
--从表B中每周一到周五查询出数据放到表A中。--创建testa,testb并在B中填充数据create table testa(id number(10),name varchar2(10),age varchar2(10), ext1 varchar2(10));create table testb(id number(10),name varchar2(10),age varchar2(10), ext1 varchar2(10));insert into testb(id,name,age,ext1) values(1,'aaa','2','1');insert into testb(id,name,age,ext1) values(2,'bbb','2','1');insert into testb(id,name,age,ext1) values(3,'ccc','2','1');--创建存储过程protestcreate or replace procedure protestisbegin if( TO_CHAR(SYSDATE,'DAY') = '星期一' or TO_CHAR(SYSDATE,'DAY') ='星期二'or TO_CHAR(SYSDATE,'DAY') ='星期三'or TO_CHAR(SYSDATE,'DAY') ='星期四'or TO_CHAR(SYSDATE,'DAY') ='星期五') theninsert into testa ( id, name,age,ext1) (select id,name,age,ext1 from testb); commit; end if; end; --运行--在命令窗口运行 exec statistics_loginTimes_by_day--然后在job中添加即可,每天定时运行