当前位置:网站首页>oracle通过触发器和序列来定义自增主键,并且设置定时任务每秒钟插入一条数据到目标表
oracle通过触发器和序列来定义自增主键,并且设置定时任务每秒钟插入一条数据到目标表
2022-04-23 06:04:00 【旺财2】
create table classinfo(
classid number(2) primary key,
classname varchar(10) not null
);
-- Create sequence
create sequence CLASSINFO_SEQ
minvalue 1
maxvalue 9999999999999999999999999999
start with 1
increment by 1
nocache;
CREATE OR REPLACE TRIGGER
CLASSINFO_TRIGGER
before insert on classinfo
for each row
declare
begin
select CLASSINFO_SEQ.NEXTVAL into :NEW.classid from DUAL;
end ;
insert into classinfo values(null,'aaa');
insert into classinfo values(null,'aaa');
insert into classinfo values(null,'aaa');
insert into classinfo values(null,'aaa');
select * from classinfo
create or replace procedure CLASSINFO_PRO is
begin
insert into classinfo values(null,'aaa');
end CLASSINFO_PRO;
declare
job number;
BEGIN
DBMS_JOB.SUBMIT(
JOB => job, /*自动生成JOB_ID*/
WHAT => 'CLASSINFO_PRO;', /*需要执行的存储过程名称或SQL语句*/
NEXT_DATE => sysdate+1/(24*60), /*初次执行时间下一分钟*/
INTERVAL => 'sysdate+1/(24*60*60)' /*每隔1秒钟执行一次*/
);
commit;
end;
select * from user_jobs;
版权声明
本文为[旺财2]所创,转载请带上原文链接,感谢
https://blog.csdn.net/wdyliuxingfeiyang/article/details/121906169
边栏推荐
- Prometheus和Thanos Receiver的“写多租户”实现
- 双指针仪表盘读数(一)
- RAC环境数据库节点参数设置不当导致监听无法连接问题排查
- BCC installation and basic tool instructions
- Prometheus Thanos快速指南
- Abnormal record-19
- Dolphinscheduler调度sql任务建表时The query did not generate a result set异常解决
- Error alarm of Postgres master-slave replication delay monitoring
- Exception record-9
- 基于ECS搭建云上博客(云小宝码上送祝福,免费抽iphone13任务详解)
猜你喜欢
Thanos Compactor组件使用
Introduction to common APIs for EBFP programming
Implementation of multi tenant read and write in Prometheus cortex
Oracle redo log产生量大的查找思路与案例
Dolphinscheduler调度sql任务建表时The query did not generate a result set异常解决
冬季实战营 动手实战-初识上云基础,动手实操ECS云服务器新手上路 领鼠标 云小宝 背包 无影
Chaos takes you to the chaos project quickly
Prometheus Thanos快速指南
实践使用PolarDB和ECS搭建门户网站
Detailed explanation of RDMA programming
随机推荐
异常记录-17
微服务架构核心概念
异常记录-15
Prometheus Cortex架构概述(水平可扩展、高可用、多租户、长期存储)
异常记录-11
OVS and OVS + dpdk architecture analysis
Abnormal record-20
Implementation of multi tenant read and write in Prometheus cortex
冬季实战营 动手实战-MySQL数据库快速部署实践 领鼠标 云小宝
Oracle net service: listener and service name resolution method
oracle计算两日期相差多少秒,分钟,小时,天
BCC installation and basic tool instructions
Common views of Oracle database performance analysis
Research on alertmanager repeated / missing alarm phenomenon and two key parameters_ Wait and group_ Interpretation of interval
异常记录-16
Django::Did you install mysqlclient?
oracle undo使用率高问题处理
Dolphinscheduler配置Datax踩坑记录
解决:You have 18 unapplied migration(s). Your project may not work properly until you apply
冬季实战营动手实战-上云必备环境准备,动手实操快速搭建LAMP环境 领鼠标 云小宝 背包 无影