mysql编程,如何存储多个查询结果
mysql存储
大家好,我的需求是这样的,在写mysql存储过程的时候,
在循环游标中的数据时,根据数据会继续查询相关记录
#开始获取游标的值
FETCH root_knowledge_cursor INTO _knowledge_id,_knowledge_code;
#此处查到的记录会是多条!我可以采用什么样的数据类型来存储这多条记录的结果(_childKids)?并将该结果进行遍历,依次存储到另一张表中?这就是我的问题
SELECT knowledge_id INTO _childKids FROM edu_knowledge k
WHERE k.knowledge_code
LIKE CONCAT(_knowledge_code,'%');
IF _childKids IS NOT NULL THEN
#此处希望可以循环 _childKids ,依次向表插入记录
INSERT INTO a(rootKid,childKid) VALUES (_knowledge_id,_childKid);
#_childKid为遍历_childKids 时取得的值
END IF;
UNTIL flag
END REPEAT;
CLOSE root_knowledge_cursor;
如果有表达不清楚的地方,还请大家指正!
没有C币悬赏不了,还请见谅!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)
