惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
J
Java Code Geeks
雷峰网
雷峰网
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
V
Vulnerabilities – Threatpost
S
Securelist
The Hacker News
The Hacker News
The Register - Security
The Register - Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
G
Google Developers Blog
Hugging Face - Blog
Hugging Face - Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
M
MIT News - Artificial intelligence
AI
AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Schneier on Security
Schneier on Security
N
Netflix TechBlog - Medium
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
Hacker News - Newest:
Hacker News - Newest: "LLM"
H
Hacker News: Front Page
博客园 - 司徒正美
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
B
Blog
Microsoft Azure Blog
Microsoft Azure Blog
大猫的无限游戏
大猫的无限游戏
Security Latest
Security Latest
Engineering at Meta
Engineering at Meta
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
U
Unit 42
V
V2EX
V2EX - 技术
V2EX - 技术
L
LINUX DO - 最新话题
aimingoo的专栏
aimingoo的专栏
Microsoft Security Blog
Microsoft Security Blog
Recorded Future
Recorded Future
P
Privacy & Cybersecurity Law Blog
美团技术团队
小众软件
小众软件
F
Fortinet All Blogs

博客园 - hunter_gio

用xargs处理带空格文件名 利用awk分割电子书大文件 linux中shell变量$#,$@,$0,$1,$2的含义解释 推荐几本Python电子书 学习Shell好书 C/C++ 电子书推荐 Unicode5.1版发布 GB18030编码研究以及GBK、GB18030与Unicode的映射[转] Unicode、GB2312、GBK和GB18030中的汉字[转] 中日韩统一表意文字(CJK Unified Ideographs)[转] Unicode介绍[转] simple usage of tcpdump Python语言浅议 巴菲特:我的工作是阅读 我喜欢的Ubuntu软件列表 del.icio.us导出到google书签 解决w950播放RM视频的问题[转] Python 3.0a1 Release [Ebook]The Definitive Guide to SQLite
ORACLE----触发器,存储过程及JOB
hunter_gio · 2007-08-15 · via 博客园 - hunter_gio

一、ORACLE中创建自增的ID字段
1、创建序列
 create *sequence_name*  increment by 1 start with 1 maxvalue 999999999;
2、创建触发器---(创建一个基于该表的before insert 触发器,在触发器中使用该SEQUENCE)
create or replace trigger *triger_name*
before insert on       *table_name*
referencing old as old new as new for each row
begin
select  *sequence_name.nextval into :new.id from dual;
end;
/
二、ORACLE中JOB的应用
1、创建存储过程
create or replace procedure    *pro_name
as
begin
 insert into agri_exhibition_basecur (messid,title,type,pub_date)   select id,title,sort,pub_date from agri_message  where    (trunc(sysdate-pub_date)=0 and rownum<6) and sort='供' ;
 insert into agri_exhibition_basecur (messid,title,type,pub_date)   select id,title,sort,pub_date from agri_message  where    (trunc(sysdate-pub_date)=0 and rownum<6) and sort='求' ;
end;
/
2、创建JOB
variable jobdxm number;
begin
dbms_job.submit(:jobdxm,'exhi_pro_dxm;',sysdate,'trunc(sysdate,''dd'')+32.5/24');
end;
三、收集的一个简单的JOB实列
1、创建测试表
SQL> create table a(a date);

表已创建。

2、创建一个自定义过程
SQL> create or replace procedure test as
  2  begin
  3  insert into a values(sysdate);
  4  end;
  5  /

过程已创建。

3、创建JOB
SQL> variable job1 number;
SQL>
SQL> begin
  2  dbms_job.submit(:job1,'test;',sysdate,'sysdate+1/1440');  --每天1440分钟,即一分钟运行test过程一次
  3  end;
  4  /

PL/SQL 过程已成功完成。

4、运行JOB
SQL> begin
  2  dbms_job.run(:job1);
  3  end;
  4  /

PL/SQL 过程已成功完成。

SQL> select to_char(a,'yyyy/mm/dd hh24:mi:ss') 时间 from a;

时间
-------------------
2001/01/07 23:51:21
2001/01/07 23:52:22
2001/01/07 23:53:24

5、删除JOB
SQL> begin
  2  dbms_job.remove(:job1);
  3  end;
  4  /

PL/SQL 过程已成功完成。
6、一些必要的参数
修改initsid.ora参数
job_queue_processes = 4
job_queue_interval = 10
job_queue_keep_connections=true

修改可执行作业个数为20个
ALTER SYSTEM SET JOB_QUEUE_PROCESSES = 20

修改取消限制模式
ALTER SYSTEM DISABLE RESTRICTED SESSION;

7、两个必要的表
      user_jobs及dba_jobs_running

8、相关的几个JOB操作
删除job:dbms_job.remove(jobno);
修改要执行的操作:job:dbms_job.what(jobno,what);
修改下次执行时间:dbms_job.next_date(job,next_date);
修改间隔时间:dbms_job.interval(job,interval);
停止job:dbms.broken(job,broken,nextdate);
启动job:dbms_job.run(jobno);