Oracle存储过程
来源:互联网 发布:mac air怎么有两个账户 编辑:程序博客网 时间:2024/06/07 23:31
set serveroutput on;
call job_rely_latest(8128,201707180000);
select * from tmp_res_8128;
truncate table tmp_res_8128;
create or replace procedure job_rely_latest(job_id in number, dt in number) as sid number; start_time varchar2(50); end_time varchar2(50); cnt number;begin sid := job_id; delete from tmp_res_8128; while sid > 0 loop select count(1) into cnt from dspmt.job_log t where t.job_frequency = dt and t.job_id in (select to_number(column_value) job_id from table (select strsplit(replace(replace(prerequisites, '[', ''), ']', ''), ',') from DSPDATA.RS_JOB_ESIMATED_TIME t where t.job_id = sid and prerequisites is not null)) and t.end_time < (select * from (select start_time from dspmt.job_log t2 where t2.job_frequency = dt and t2.job_id = sid order by start_time asc) where rownum = 1); if cnt < 1 then dbms_output.put_line('循环结束'); return; end if; select job_id, start_time, end_time into sid, start_time, end_time from (select * from dspmt.job_log t where t.job_frequency = dt and t.job_id in (select to_number(column_value) job_id from table (select strsplit(replace(replace(prerequisites, '[', ''), ']', ''), ',') from DSPDATA.RS_JOB_ESIMATED_TIME t where t.job_id = sid)) and t.end_time < (select * from (select start_time from dspmt.job_log t2 where t2.job_frequency = 201707180000 and t2.job_id = sid order by start_time asc) where rownum = 1) order by t.end_time desc) where rownum = 1; dbms_output.put_line(sid); if sid < 1 then -- idx := 10000; dbms_output.put_line('循环结束'); return; end if; insert into tmp_res_8128 select sid, start_time, end_time from dual; commit; end loop;end job_rely_latest;
阅读全文
0 0
- Oracle:存储过程,存储函数
- Oracle-存储过程 存储函数
- Oracle存储过程、存储函数
- oracle 存储函数,存储过程
- Oracle存储过程
- 调试oracle存储过程。
- ORACLE 存储过程实战
- Oracle 存储过程
- oracle存储过程使用
- Oracle 创建存储过程
- 调试oracle存储过程
- oracle java存储过程
- 创建Oracle存储过程
- 加密oracle存储过程
- oracle存储过程分页
- oracle存储过程笔记
- ORACLE存储过程--注意事项
- oracle procedure 存储过程
- 写个工具类关闭所有流,方便快捷
- 嵌入式系统学习——S3C2451之定时器
- POJ 3048 Max Factor 笔记
- 语句(Statement)---循环跳转
- 指针基础
- Oracle存储过程
- LeetCode-257. Binary Tree Paths (Java)
- 非阻塞式connect
- HTML学习笔记
- JavaScript 引擎的LHS查询和RHS查询
- linux进程管理与调度(一)
- 一文搞懂傅里叶变换
- 实现类似“另存为”的功能
- 静态链接 和 动态链接