当前位置:网站首页>Oracle writes a trigger that inserts a piece of data first and updates a field in the data
Oracle writes a trigger that inserts a piece of data first and updates a field in the data
2022-06-25 23:53:00 【langmeng110】
The trigger has just been used recently , In principle, it should be updated after insertion , I thought it was written in the following way , I also found many methods on the Internet , The results are not quite right . The fields that need to be updated have not been updated at all , I think it should be a logical problem :
create or replace trigger UPDATE_REDLIST_TYPE
after insert on redlist_pass_person
for each row
declare
-- local variables here
redlist_flag varchar2(10);
begin
select (case
when count(1) > 0 then
'1'
else
'0'
end)
into redlist_flag
from redlist_person t1
where t1.redlist_card_no = :new.card_no;
update redlist_pass_person set redlist_type=redlist_flag where :old.id = :new.id;
end UPDATE_REDLIST_TYPE;
Found behind , It needs to be written like this :
create or replace trigger UPDATE_REDLIST_TYPE
before insert on redlist_pass_person
for each row
declare
-- local variables here
redlist_flag varchar2(10);
begin
select (case
when count(1) > 0 then
'1'
else
'0'
end)
into redlist_flag
from redlist_person t1
where t1.redlist_card_no = :new.card_no;
:new.redlist_type := redlist_flag;
end UPDATE_REDLIST_TYPE;
therefore , Write this down , And let more friends not waste a lot of time on this little problem ...
Just like what you like (* ̄︶ ̄)
边栏推荐
- mongodb
- Raspberry pie sends hotspot for remote login
- How does excel translate Chinese words into English automatically? This formula teaches you
- CXF
- 常用的几款富文本编辑器
- Talk about the copy on write mechanism of PHP variables or parameters
- C ++ 引用与指针总结
- Using Google protobuf protocol environment configuration in PHP
- JS中常用知识点
- Today's 61 Fu
猜你喜欢

Wireshark对IMAP抓包分析

STL教程5-STL基本概念及String和vector使用

YUV444、YUV422、YUV420、YUV420P、YUV420SP、YV12、YU12、NV12、NV21

idea Kotlin版本升级

The simplest screen recording to GIF gadget in history, licecap, can be tried if the requirements are not high

C ++ 引用与指针总结

Unable to start debugging. Unexpected GDB output from command “-environment -cd xxx“ No such file or

Architecture part -- the use of UMI framework and DVA

Line height for small use

懒人教你用猕猴桃一月饱减16斤_过路老熊_新浪博客
随机推荐
今天说说String相关知识点
Common methods of object class
STL教程5-STL基本概念及String和vector使用
mysql集群
Summary of c++ references and pointers
The role of iomanip header file in actual combat
php socket通信中stream_select方法的理解
权限设计=功能权限+数据权限
Kotlin null pointer bug
Wireshark对IMAP抓包分析
STEP7主站与远程I/O组网_过路老熊_新浪博客
在win10下使用visual studio2015链接mysql数据库
Uniapp -- list page of multi header tabs
7.常用指令(下)v-on,v-bind,v-model的常见操作
谈一谈PHP变量或参数的Copy On Write机制
动态验证码
WINCC与STEP7的仿真连接_过路老熊_新浪博客
解析產品開發失敗的5個根本原因
C ++ 引用与指针总结
Kylin