当前位置:网站首页>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;
边栏推荐
- Basic use and optimization of uitableview
- Following the example of IE, is the decline of Firefox inevitable?
- 运行loam_velodyne实时建图
- 下棋机器人折断7岁男孩手指,网友:违反了机器人第一定律
- Maximum number less than n
- [SAML SSO solution] Shanghai daoning brings you SAML for asp NET/SAML for ASP. Net core download, trial, tutorial
- 20年前,他是马云最大的敌人
- URL return nil and urlhash processing
- Smart fish tank design based on stm32
- Gods at dusk, "cat trembles" bid farewell to the big V Era
猜你喜欢

KMP template - string matching

基于STM32的智能鱼缸设计

Gree "not cool": the giant lawsuit ended and was reduced by large dealers. Is it too late for the new battlefield of air conditioning?

Switch and router technology-03-basic configuration of switch

Understand the staticarea initialization logic of SAP ui5 application through the initialization of fileuploader

Some suggestions for writing original technical articles

MLX90640 红外热成像仪测温传感器模块开发笔记(七)
![[MCU] 2.2 pin function of AT89S52](/img/d0/b204efb80ec5f0b7bc2d83d0250eb9.png)
[MCU] 2.2 pin function of AT89S52

通过 FileUploader 的初始化,了解 SAP UI5 应用的 StaticArea 初始化逻辑

数据库超话(一)
随机推荐
Database hyperphone (II)
Technical practice dry goods | from workflow to workflow
帮扶、提振、担当,第六届土巴兔718全民家装节的新价值和意义
Tencent cloud upload
二舅的外甥和他的学生们
Functions of C language
Big manufacturers finally can't stand "adding one second", and companies such as Microsoft, Google meta propose to abolish leap seconds
交换机和路由器技术-03-交换机基本配置
数据库超话(一)
Smart fish tank design based on stm32
SAP UI5 FileUploader 的本地文件上传技术实现分享
诸神黄昏,“猫抖快”告别大V时代
Database hyperphone (4)
.net core with microservices - what is a microservice
Kubernetes Chapter 8: deploy NFS system with kubernetes to complete database persistence (kubernetes work practice class)
[single chip microcomputer] 2.1 hardware composition of AT89S52 single chip microcomputer
【单片机】2.3 AT89S52的CPU
Xcode releases test package testflight
Gree "not cool": the giant lawsuit ended and was reduced by large dealers. Is it too late for the new battlefield of air conditioning?
JDBC连接数据库读取前台无法显示数据