I am trying to load a csv file into a temporary table and then run a compound SQL Statement on that table. I can get the DECLARE LOCAL TEMPORARY TABLE ... INPUT INTO ... FROM [filename] to work on its own, but trying to run a compound statement after that produces an error -131 After Insert Trigger Failed. I have no idea what that means as I'm not even using INSERT or triggers to my knowledge.
Here is the code.
DROP TABLE DynamicPLU;
//delete the temp table
//First Table from First File, Rename Dynamic PLU Items
DECLARE LOCAL TEMPORARY TABLE DynamicPLU (price VARCHAR(14), newName VARCHAR(255), inventory VARCHAR(14));
INPUT INTO DynamicPLU
FROM 'C:\Shared Stuff\Database Cleanup - Peter\Project - Grab-n-Go\Grab-n-Go Item Entry Test.csv'
DELIMITED BY ',';
CREATE TEMPORARY PROCEDURE GrabnGo_Update()
BEGIN
DECLARE @shortInventory INT ;
SET @shortInventory = 8 ;
//a big update statement
END;
CALL GrabnGo_Update();
I've also tried including the DECLARE statement in one big BEGIN END compound statement, but that produces the same error -131 right after the BEGIN statement, except in this case the code after the BEGIN statement would be DECLARE ... instead of CREATE ...