更新查询不会将值更新到mysql中的临时表中。
DECLARE _defaultDateTime DATETIME;
DECLARE _resourceTypeId CHAR(36);
DECLARE _billedUsageHrs DECIMAL(15,6);
DECLARE _unbilledusageHrs DECIMAL(15,6);
DECLARE _billedCost DECIMAL(15,6);
DECLARE _unBilledCost DECIMAL(15,6);
DECLARE _resourceIdentifier CHAR(36);
DROP TABLE IF EXISTS _usageTable;
CREATE TEMPORARY TABLE _usageTable(resourceinstanceId CHAR(36),billedusageinHrs DECIMAL(15,6), billedusageCost DECIMAL(15,6), unBilledusageinHrs DECIMAL(15,6), unbilledusageCost DECIMAL(15,6)) ENGINE=MEMORY;
UPDATE _usageTable SET resourceinstanceId = 'a17b5e49-000c-11e3-8bfa-842b2bac06e5' WHERE 1 = 1;
SELECT resourceinstanceId, billedusageinHrs, billedusageCost, unBilledusageinHrs, unbilledusageCost FROM _usageTable;
上述存储过程返回空行
答案 0 :(得分:0)
CREATE TEMPORARY TABLE _usageTable(resourceinstanceId CHAR(36),
billedusageinHrs DECIMAL(15,6),
billedusageCost DECIMAL(15,6),
unBilledusageinHrs DECIMAL(15,6),
unbilledusageCost DECIMAL(15,6)) ENGINE=MEMORY;
UPDATE _usageTable SET resourceinstanceId = 'a17b5e49-000c-11e3-8bfa-842b2bac06e5' WHERE 1 = 1;
UPDATE
将更新现有的行。
据我所见,您刚刚创建了表格。所以它是空的。只需更新 no 行。