shell 变量
2015-12-19 14:18
471 查看
--创建视图,取最后一个审核的时间
create view v_checkServiceLastTime
as
select * from (
select row_number() over(partition by servicecode order by checkdate desc ) idx,
servicecode ,checkdate ,checkstaus
From o_Servicecheck where checkstaus='C1E'
)a where idx =1
--获取未参加评价的数据
create or replace view v_NotPingjia
as
select * from v_checkServiceLastTime a where a.servicecode not in (
select servicecode from O_servicepingjia
)
--查询当天时间减去CHECKDATE时间为3天的数据 ,并执行INSERT语句
create or replace procedure pro_job_inserPingjia
is
userRow v_NotPingjia%rowtype;
cursor userRows is select * from v_NotPingjia where sysdate -checkdate>3 ;
begin
for userRow in userRows loop
insert into o_servicepingjia(pjcode,fuwu,zhiliang,jiage,servicecode)
values(servicepingjia_seq.nextVal,5,5 ,5,userRow.servicecode);
end loop;
end ;
--创建定时器,每天执行函数 pro_job_inserPingjia
--720分钟==12个小时执行一次
declare
v_jobid number;
begin
dbms_job.submit(v_jobid,'pro_job_inserPingjia;',sysdate,'trunc(sysdate+720/1440,''mi'')');
commit;
end;
--查看任务队列
select job ,next_date,next_sec,failures, broken from user_jobs ;
select * from user_jobs;
--停止任务
begin
dbms_job.remove(25);
end ;
commit;
select trunc(sysdate+1,'mi') from dual;
create view v_checkServiceLastTime
as
select * from (
select row_number() over(partition by servicecode order by checkdate desc ) idx,
servicecode ,checkdate ,checkstaus
From o_Servicecheck where checkstaus='C1E'
)a where idx =1
--获取未参加评价的数据
create or replace view v_NotPingjia
as
select * from v_checkServiceLastTime a where a.servicecode not in (
select servicecode from O_servicepingjia
)
--查询当天时间减去CHECKDATE时间为3天的数据 ,并执行INSERT语句
create or replace procedure pro_job_inserPingjia
is
userRow v_NotPingjia%rowtype;
cursor userRows is select * from v_NotPingjia where sysdate -checkdate>3 ;
begin
for userRow in userRows loop
insert into o_servicepingjia(pjcode,fuwu,zhiliang,jiage,servicecode)
values(servicepingjia_seq.nextVal,5,5 ,5,userRow.servicecode);
end loop;
end ;
--创建定时器,每天执行函数 pro_job_inserPingjia
--720分钟==12个小时执行一次
declare
v_jobid number;
begin
dbms_job.submit(v_jobid,'pro_job_inserPingjia;',sysdate,'trunc(sysdate+720/1440,''mi'')');
commit;
end;
--查看任务队列
select job ,next_date,next_sec,failures, broken from user_jobs ;
select * from user_jobs;
--停止任务
begin
dbms_job.remove(25);
end ;
commit;
select trunc(sysdate+1,'mi') from dual;
相关文章推荐
- Bash判断是否是root
- shell字符串处理
- Bash循环分类介绍
- Bash判断文件夹(目录)是否存在
- Bash判断文件是否存在
- Bash中的数组
- shell 入门
- 《linux命令行与shell脚本编程大全》学习笔记(2)
- <<linux命令行与shell脚本编程大全>>学习笔记(1)
- 命令行PowerShell学习心得
- linux一个简单的myshell
- powershell玩转xml之20问
- Xshell配置ssh免密码登录-密钥公钥(Public key)与私钥(Private Key)登
- Linux 每日一练 :显示你当前bash 的进程PID:$$
- ~/.bashrc和/etc/profile的異同
- Deep Learning in a Nutshell: History and Training
- Shell 字符串比较
- bash 学习一 变量、参数、判断与循环
- shell中${ } 用法详解
- shell脚本中的EOF以及文件重定向