ilya iz
ilya iz

Reputation: 470

Temporary table doesn't exist error

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";

Upvotes: 1

Views: 3682

Answers (1)

NPE
NPE

Reputation: 500217

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.

What happens is that:

  • DROP TABLE, CREATE TABLE and SELECT operate on repots (without the r);
  • INSERT tries to insert into reports (with the r) and fails.

Upvotes: 3

Related Questions