存储过程不在Mysql中输入参数

问题描述 投票:0回答:1

我创建了一个存储过程。如下

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');

我的输入参数没有提升。所以临时表是用所有记录创建的。

mysql sql stored-procedures
1个回答
0
投票

我犯的错误是,

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;
© www.soinside.com 2019 - 2024. All rights reserved.