Creating temporary tables in MySQL Stored Procedure

Posted by burntblark on Stack Overflow See other posts from Stack Overflow or by burntblark
Published on 2011-03-15T08:07:32Z Indexed on 2011/03/15 8:09 UTC
Read the original article Hit count: 166

Filed under:
|
|

The following procedure gives me an error when I invoke it using the CALL statement:


CREATE DEFINER=`user`@`localhost` PROCEDURE `emp_performance`(id VARCHAR(10))
BEGIN
DROP TABLE IF EXISTS performance;
CREATE TABLE performance AS  
    SELECT time_in, time_out, day FROM attendance WHERE employee_id = id;
END

The error says "Unknown table 'performance' ".

This is my first time actually using stored procedures and I got my sources from Google. I just cant figure out what I am doing wrong.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about sql