当前位置:网站首页>Oracle defines self incrementing primary keys through triggers and sequences, and sets a scheduled task to insert a piece of data into the target table every second
Oracle defines self incrementing primary keys through triggers and sequences, and sets a scheduled task to insert a piece of data into the target table every second
2022-04-23 13:40:00 【Wangcai 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, /* Automatic generation JOB_ID*/
WHAT => 'CLASSINFO_PRO;', /* The name of the stored procedure to execute or SQL sentence */
NEXT_DATE => sysdate+1/(24*60), /* First execution time next minute */
INTERVAL => 'sysdate+1/(24*60*60)' /* every other 1 Once per second */
);
commit;
end;
select * from user_jobs;
版权声明
本文为[Wangcai 2]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230604301121.html
边栏推荐
- [point cloud series] summary of papers related to implicit expression of point cloud
- Example of specific method for TIA to trigger interrupt ob40 based on high-speed counter to realize fixed-point machining action
- TCP reset Gongji principle and actual combat reproduction
- Example interview | sun Guanghao: College Club grows and starts a business with me
- Personal learning related
- CSDN College Club "famous teacher college trip" -- Hunan Normal University Station
- Esp32 vhci architecture sets scan mode for traditional Bluetooth, so that the device can be searched
- Database transactions
- 超40W奖金池等你来战!第二届“长沙银行杯”腾讯云启创新大赛火热来袭!
- GDB的使用
猜你喜欢
Why do you need to learn container technology to engage in cloud native development
Stack protector under armcc / GCC
Lpddr4 notes
On the bug of JS regular test method
Common interview questions and detailed analysis of the latest Android developers in 2020
Campus takeout system - "nongzhibang" wechat native cloud development applet
[official announcement] Changsha software talent training base was established!
你和42W奖金池,就差一次“长沙银行杯”腾讯云启创新大赛!
交叉碳市场和 Web3 以实现再生变革
校园外卖系统 - 「农职邦」微信原生云开发小程序
随机推荐
Loading and using image classification dataset fashion MNIST in pytorch
Processbuilder tool class
Cross carbon market and Web3 to achieve renewable transformation
【行走的笔记】
校园外卖系统 - 「农职邦」微信原生云开发小程序
NPM err code 500 solution
[Journal Conference Series] IEEE series template download guide
超40W奖金池等你来战!第二届“长沙银行杯”腾讯云启创新大赛火热来袭!
[point cloud series] multi view neural human rendering (NHR)
Campus takeout system - "nongzhibang" wechat native cloud development applet
“湘见”技术沙龙 | 程序员&CSDN的进阶之路
这个SQL语名是什么意思
"Xiangjian" Technology Salon | programmer & CSDN's advanced road
[point cloud series] neural opportunity point cloud (NOPC)
Example of specific method for TIA to trigger interrupt ob40 based on high-speed counter to realize fixed-point machining action
TERSUS笔记员工信息516-Mysql查询(2个字段的时间段唯一性判断)
SAP ui5 application development tutorial 72 - animation effect setting of SAP ui5 page routing
Interface idempotency problem
叮~ 你的奖学金已到账!C认证企业奖学金名单出炉
Why do you need to learn container technology to engage in cloud native development