我创建了一个存储过程。如下
CREATE DEFINER=`root`@`localhost` PROCEDURE `Test_Procedure`(IN INTERNAL_TRANSACTION_ID varchar(50))
BEGIN
SET @@session.sql_notes = 0;
DROP TEMPORARY TABLE IF EXISTS tivobatch.temp;
create TEMPORARY table tivobatch.temp engine=memory AS
SELECT INTERNAL_TRANSACTION_ID FROM CONTENT_WORKFLOW_STAGING WHERE
INTERNAL_TRANSACTION_ID = INTERNAL_TRANSACTION_ID;
SELECT * FROM tivobatch.temp;
DROP TEMPORARY TABLE IF EXISTS tivobatch.temp;
SET @@session.sql_notes = 1;
END
我把我的存储过程称为
CALL Test_Procedure('74850c0f-4f2c-4894-aa1f-148078f84db0');
我的输入参数没有提升。所以临时表是用所有记录创建的。
我犯的错误是,
SELECT INTERNAL_TRANSACTION_ID FROM CONTENT_WORKFLOW_STAGING WHERE INTERNAL_TRANSACTION_ID = INTERNAL_TRANSACTION_ID;
我在WHERE CLAUSE中添加了tablename.INTERNAL_TRANSACTION_ID。
如
SELECT INTERNAL_TRANSACTION_ID FROM CONTENT_WORKFLOW_STAGING WHERE CONTENT_WORKFLOW_STAGING .INTERNAL_TRANSACTION_ID = INTERNAL_TRANSACTION_ID;