Home > database >  Use temporary tables in mysql stored procedures doesn exist error
Use temporary tables in mysql stored procedures doesn exist error

Time:10-06

 CREATE DEFINER=` ABC ` @ ` localhost ` PROCEDURE ` site_data_conversion ` (in $src_site_id int, in $t_site_id int, out $return_code int, out $result_code int) 
The BEGIN


Declare _err int the default 0;
DECLARE the CONTINUE HANDLER FOR SQLEXCEPTION, SQLWARNING set _err=1;

START the TRANSACTION;



CREATE TEMPORARY TABLE ` ABC `. ` tmp_table ` select * from the items where site_id=$src_site_id;

The update ` ABC `. ` tmp_table ` set site_id=$t_site_id where site_id=$src_site_id;
Show warnings;
Insert into the items the select * from ` ABC `. ` tmp_table `;
Show warnings;

The DROP TEMPORARY TABLE IF the EXISTS ` ABC `. ` tmp_table `;



If _err=1 then
The ROLLBACK.
The set $return_code=0;
The set $result_code=0;
The else
COMMIT;
The set $return_code=1;
The set $result_code=ROW_COUNT ();
End the if;

END


Execution will prompt Table 'ABC. Tmp_table doesn' t exist


CodePudding user response:

Remove part of the code, try again to see which is a specific fault,

CodePudding user response:

On the console to perform normal, the stored procedure is suggested in Table 'ABC. Tmp_table' doesn 't exist, can't be deleted redundant code,
  • Related