当前位置:网站首页>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
边栏推荐
- 冬季实战营动手实战-上云必备环境准备,动手实操快速搭建LAMP环境 领鼠标 云小宝 背包 无影
- 异常记录-7
- prometheus告警记录持久化(历史告警保存与统计)
- [MySQL basics] startup options and configuration files
- Using Prom label proxy to implement label based multi tenant reading of Prometheus thanos
- Abnormal record-18
- 实践使用PolarDB和ECS搭建门户网站
- Oracle net service: listener and service name resolution method
- [fish in the net] ansible awx calls playbook to transfer parameters
- timestamp隐式转换问题导致索引列未使用问题分析
猜你喜欢

基於ECS搭建雲上博客(雲小寶碼上送祝福,免費抽iphone13任務詳解)

Dolphinscheduler配置Datax踩坑记录

你应该知道的 JVM 基础知识

Introduction to RDMA network

try catch 不能捕获异步错误

Thanos Compact组件测试总结(处理历史数据)

10g数据库使用大内存主机时不能启动的问题

OSS云存储管理实践(体验有礼)

qs. In the stringify interface, the input parameter is converted into a & connected string (with the application / x-www-form-urlencoded request header)

使用prom-label-proxy实现Prometheus Thanos的基于标签的多租户读
随机推荐
Prometheus cortex Architecture Overview (horizontally scalable, highly available, multi tenant, long-term storage)
关于Postgres主从复制延迟监控的错误告警问题
B站用户视频观看记录的存储方案
异常记录-5
Prometheus Cortex架构概述(水平可扩展、高可用、多租户、长期存储)
Abnormal record-21
Prometheus的relabel_configs和metric_relabel_configs解释及用法示例
TC ebpf practice
[MySQL basics] startup options and configuration files
Dolphinscheduler调度sql任务建表时The query did not generate a result set异常解决
Virtio and Vhost_ Net introduction
select命令产生redo日志问题的分析
oracle undo使用率高问题处理
Prometheus alarm record persistence (historical alarm saving and Statistics)
基于EMR离线数据分析-反馈有礼
关于我
异常记录-9
Redis 详解(基础+数据类型+事务+持久化+发布订阅+主从复制+哨兵+缓存穿透、击穿、雪崩)
异常记录-21
pycharm Install packages failed