I want to pass the query into the stored procedure as a parameter and execute the stored procedure.
I want to do like this one,
DELIMITER $$
CREATE PROCEDURE function1(query1, query2, query3)
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION,SQLWARNING
rollback;
start transaction;
// I want to execute query 1 here
// I want to execute query 2 here
// I want to execute query 3 here
commit;
END
Please help me here how can I pass the whole queries into the stored procedure as a parameter and execute parallel.
Thank you in advance
You can use EXECUTE IMMEDIATE to run the queries. EXECUTE IMMEDIATE 'QUERY1'; will execute QUERY1. As pointed out by @sticky bit beware of malicious statements.
https://docs.oracle.com/cd/B13789_01/appdev.101/b10807/13_elems017.htm
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.