添加表、字段、存储过程、定时任务
来源:互联网 发布:人工智能saas 编辑:程序博客网 时间:2024/06/06 18:02
-- Create table
create table UPDATE_MSG_CONTENT_LOG
(
detail VARCHAR2(300),
content VARCHAR2(1536),
subject VARCHAR2(300),
pk_message CHAR(20) not null,
backupts DATE,
ts CHAR(19),
receiver CHAR(20)
)
tablespace NNC_DATA01
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 8K
minextents 1
maxextents unlimited
);
-- Alter table
alter table UPDATE_MSG_CONTENT_LOGstorage
(
next 1
)
;
-- Add/modify columns
alter table UPDATE_MSG_CONTENT_LOG add receiver CHAR(20);
create or replace procedure Update_Msg_Content
IS
---游标
CURSOR TEMP_CUR IS
select DETAIL,CONTENT,SUBJECT,RECEIVER,PK_MESSAGE,SYSDATE BACKUPTS,TS
from sm_msg_content
where DETAIL not in
((select pk_leaveh || '@6404@' || bill_code from tbm_leaveh) UNION ALL(select pk_overtimeh||'@6405@'||bill_code from tbm_overtimeh))
and (DETAIL like '%@6404@%' OR DETAIL like '%@6405@%')
and msgtype <> 'email'
and msgsourcetype ='notice'
and isdelete = 'N'
and ishandled = 'N'
and isread = 'N';
begin
For TEMP_CUR_RECORD in TEMP_CUR loop---遍历游标
IF TEMP_CUR_RECORD.RECEIVER IS NOT NULL THEN
INSERT INTO Update_Msg_Content_LOG(Detail, Content, Subject, Receiver, Pk_Message, Backupts, Ts) VALUES (TEMP_CUR_RECORD.DETAIL,TEMP_CUR_RECORD.CONTENT,TEMP_CUR_RECORD.SUBJECT,TEMP_CUR_RECORD.RECEIVER,TEMP_CUR_RECORD.PK_MESSAGE,TEMP_CUR_RECORD.BACKUPTS,TEMP_CUR_RECORD.TS);
UPDATE sm_msg_content SET sm_msg_content.isdelete = 'Y' WHERE sm_msg_content.Pk_Message=TEMP_CUR_RECORD.PK_MESSAGE;
ELSE
INSERT INTO Update_Msg_Content_LOG(Detail, Content, Subject, Receiver, Pk_Message, Backupts, Ts) VALUES (TEMP_CUR_RECORD.DETAIL,TEMP_CUR_RECORD.CONTENT,TEMP_CUR_RECORD.SUBJECT,TEMP_CUR_RECORD.RECEIVER,TEMP_CUR_RECORD.PK_MESSAGE,TEMP_CUR_RECORD.BACKUPTS,TEMP_CUR_RECORD.TS);
UPDATE sm_msg_content SET sm_msg_content.isread = 'Y' WHERE sm_msg_content.Pk_Message=TEMP_CUR_RECORD.PK_MESSAGE;
END IF;
end loop;
commit;
end;
Declare
i Integer;
Begin
dbms_job.submit(i,'Update_Msg_Content;',Sysdate,'TRUNC(sysdate+1)+2/24');
end;
/*begin
sys.dbms_job.change(job => 21,
what => 'Update_Msg_Content;',
next_date => to_date('23-11-2017 16:12:17', 'dd-mm-yyyy hh24:mi:ss'),
interval => 'TRUNC(sysdate+1)+17/24');
commit;
end;
/ */
- 添加表、字段、存储过程、定时任务
- 存储过程定时任务
- ORACLE定时任务调用存储过程动态为表添加分区
- mysql 存储过程+定时任务
- mysql存储过程 定时任务
- mysql存储过程 定时任务
- Mysql定时任务&存储过程
- 添加字段的存储过程
- MySql 定时任务和存储过程,每月创建一张表
- Oracle 的存储过程和定时任务
- Oracle job procedure 存储过程定时任务
- linux定时任务 掉mysql 存储过程
- Oracle job procedure 存储过程定时任务
- mysql定时任务与存储过程实例
- 数据库创建存储过程,做为定时任务
- Oracle job procedure 存储过程定时任务
- Oracle job procedure 存储过程定时任务
- Oracle job procedure 存储过程定时任务
- 用OpenCV和Dlib进行人脸颜值预测-解析
- idea 创建 maven web项目
- 我的物联网项目(十二) 单体应用架构不行?
- OpenCv 灰度直方图显示
- mysql数据导出
- 添加表、字段、存储过程、定时任务
- 反射实现代码
- Java集合 --- HashMap底层实现和原理
- 跨域(本身域名)导致的session失效
- 开始前端——第四篇
- 在Ogre1.7下编译OgreOpcode 问题
- C++解析JSON之jsoncpp
- Python笔记——sorted
- size_type和int为什么不能直接比较