找了一家短信提供商,人家提供了一个工具可以直接读取数据库表,唯独不支持视图,人家提供商不愿意修改程序,那只好我自己搞了,原来想写个win程序,放在服务器上定时读取,写到一张表里,后来发现oracle job功能很好用。
1、新建一张表(fid要是自动增长,省略)
create table TMESSAGESEND
(
FID NUMBER(38) not null,
FSUBJECT VARCHAR2(256),
FTEL VARCHAR2(11),
FDATE DATE,
FSTATE NUMBER,
FEXTEND VARCHAR2(10)
)
tablespace 表空间 pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
minextents 1
maxextents unlimited
);
-- Create/Recreate primary, unique and foreign key constraints
alter table TMESSAGESEND
add constraint TMESSAGESEND_FID primary key (FID)
using index
tablespace 表空间
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);
2、写了一个存储过程:
创建存储过程
create or replace procedure PAddMessage
as
begin
insert into tmessagesend (fsubject,ftel,fstate) select fsubject||' '||FSPERSONNAME as v1,fnum,0 from v_sendmessage;
update TTASKMESSAGE set EMessagesState=1 where nvl(EMessagesState,0)=0;
commit;
end;
3、创建job 定时执行,具体截个图吧
10分钟执行一次存储过程,这样就ok了
最新评论