当前位置:网站首页>Mysql database defines cursor in trigger
Mysql database defines cursor in trigger
2022-07-27 17:43:00 【「 25' h 」】
The way to define local variables in a database stored procedure must be defined at the beginning of the stored procedure , Then the cursor is a keyword DECLARE Statement , So the essence is still a local variable , Can only be defined at the beginning , So when defining a cursor ,my_cur Can only be defined at the beginning , Can no longer IF Define use after condition .
The conclusion is : trigger / Define local variables in stored procedures / Trigger can only be at the beginning
in addition :IF The function body after the condition cannot be empty
DELIMITER //
CREATE TRIGGER before_delete
BEFORE DELETE ON manages
FOR EACH ROW
BEGIN
DECLARE tar_ID CHAR ( 12 ) ;
DECLARE my_cur CURSOR
FOR
SELECT ch
FROM test
WHERE test.ch="a";
IF tar_ID=OLD.manage_ID THEN
OPEN my_cur;
# Use cursors
FETCH my_cur INTO tar_ID;
close my_cur;
END IF;
END
DROP TRIGGER before_insert;
边栏推荐
- Database hyperphone (II)
- Purchase in Appstore
- 交换机和路由器技术-03-交换机基本配置
- (2) CBAM integrated two stream project construction - data preparation
- 【数据库系统概论(王珊)】第5章——数据库完整性
- 神经网络实现手写数字分类matlab
- General process of background management system permission setting
- [MCU] 2.2 pin function of AT89S52
- Database hyperphone (I)
- Rare discounts on Apple's official website, with a discount of 600 yuan for all iphone13 series; Chess robot injured the fingers of chess playing children; Domestic go language lovers launch a new pro
猜你喜欢
随机推荐
Dense optical flow extraction dense_ Flow understanding
Hegong sky team vision training Day7 - vision, Jetson naon and d435i
KMP模板——字符串匹配
Mysql: function
The 7-year-old boy broke his finger by AI robot just because he played chess too fast?
运行loam_velodyne实时建图
helm安装kubevela完整Makefile脚本内容
Windows and network foundation-15-local security policy
Coca Cola's primary challenge is not vitality forest
如何开发一款在线Excel表格系统(上)
Flutter的布局
About paths mapping in SAP ui5 application ui5.yaml
步 IE 后尘,Firefox 的衰落成必然?
MySQL: Functions
【cf】#681 A. Kids Seating (Div. 2, based on VK Cup 2019-2020 - Final)
Maximum number less than n
An analysis of CPU explosion of a smart logistics WCS system in.Net
详解二叉树之堆
.net core with microservices - what is a microservice
Database hyperphone (I)








