Hello everyone, my requirement is as follows: When writing a mysql stored procedure, data in the cyclic cursor will continue to be queried based on the data # get the cursor value fetchroot_knowledge_cursor1__knowledge_id, _ knowledge_code; # Multiple records will be found here! What type of data can I use to store the results of these multiple records (_ childKids )? And traverse the result and store it in another table in sequence? This is my problem: selectknowledge_id1__childkidsfrom... mysql storage
Hello everyone, my requirements are as follows: When writing a mysql stored procedure,
When the data in the cyclic cursor is queried, the related records are queried based on the data.
# Start to get the cursor value
FETCH root_knowledge_cursor INTO _ knowledge_id, _ knowledge_code;
# Multiple records will be found here! What type of data can I use to store the results of these multiple records (_ childKids )? And traverse the result and store it in another table in sequence? This is my problem.
SELECT knowledge_id INTO _ childKids FROM edu_knowledge k
WHERE k.Knowledge_codeLike concat (_ knowledge_code, '% ');
IF _ childKids IS NOT NULL THEN
# Here we want to insert records to the table in sequence by repeating _ childKids.
Insert into a (rootKid, childKid) VALUES (_ knowledge_id, _ childKid );
# _ ChildKid is the value obtained when traversing _ childKids
End if;
UNTIL flag
End repeat;
CLOSE root_knowledge_cursor;
If you have any questions, please correct them!
If you don't have a C currency, you can't offer a reward. please forgive me!