临时表不存在错误

时间:2021-09-23 20:10:56

Couldn't call stored procedure with temporary table:

无法使用临时表调用存储过程:

DELIMITER $$
DROP PROCEDURE IF EXISTS `summary_daily_reports`$$
CREATE PROCEDURE  `summary_daily_reports`()
BEGIN

DROP TEMPORARY TABLE IF EXISTS `both_daily_repots`;

CREATE TEMPORARY TABLE both_daily_repots(
       `date`        VARCHAR(10),
       balance         DOUBLE,
       balance_ua         DOUBLE
       ) DEFAULT CHAR SET utf8;



INSERT INTO both_daily_reports VALUES ('2012-01-01',0,0);

SELECT * FROM both_daily_repots;

END $$

Then i call procedure and get error "Table 'report_cfd.both_daily_reports' doesn't exist";

然后我调用过程并得到错误“表'report_cfd.both_daily_reports'不存在”;

1 个解决方案

#1


3  

In a few places you spell the table name as both_daily_repots instead of both_daily_reports. This is what's causing the error.

在一些地方,您将表名拼写为both_daily_repots而不是both_daily_reports。这就是造成错误的原因。

What happens is that:

会发生什么:

  • DROP TABLE, CREATE TABLE and SELECT operate on repots (without the r);
  • DROP TABLE,CREATE TABLE和SELECT对repots进行操作(没有r);
  • INSERT tries to insert into reports (with the r) and fails.
  • INSERT尝试插入报告(使用r)并失败。

#1


3  

In a few places you spell the table name as both_daily_repots instead of both_daily_reports. This is what's causing the error.

在一些地方,您将表名拼写为both_daily_repots而不是both_daily_reports。这就是造成错误的原因。

What happens is that:

会发生什么:

  • DROP TABLE, CREATE TABLE and SELECT operate on repots (without the r);
  • DROP TABLE,CREATE TABLE和SELECT对repots进行操作(没有r);
  • INSERT tries to insert into reports (with the r) and fails.
  • INSERT尝试插入报告(使用r)并失败。