sql—在mysql中不接受输入参数的存储过程

qxsslcnc  于 2021-06-25  发布在  Mysql
关注(0)|答案(1)|浏览(342)

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

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

我的输入参数不起作用。所以temp表是用所有记录创建的。

krugob8w

krugob8w1#

我犯的错误是,

SELECT INTERNAL_TRANSACTION_ID FROM CONTENT_WORKFLOW_STAGING WHERE INTERNAL_TRANSACTION_ID = INTERNAL_TRANSACTION_ID;

我在where子句中添加了tablename.internal\u transaction\u id。
作为

SELECT INTERNAL_TRANSACTION_ID FROM CONTENT_WORKFLOW_STAGING WHERE CONTENT_WORKFLOW_STAGING .INTERNAL_TRANSACTION_ID = INTERNAL_TRANSACTION_ID;

相关问题