0

在两个地方出错

CREATE PROCEDURE p2()
BEGIN  
DROP PROCEDURE IF EXISTS temp_table; // unexpected end of input
CREATE TEMPORARY TABLE temp_table (count int);
insert into temp_table select max(seq) from livefeed.TMP_LIVEFEED group by ProductID;
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT minute(aa.UpdateOn) - minute(aa.TickTime), aa.* FROM livefeed.TMP_LIVEFEED aa where aa.seq in (select count from temp_table);
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
END // cross symbol error here

在这种情况下,存储过程的正确语法是什么?

4

1 回答 1

2
delimiter //    
CREATE PROCEDURE p2()
BEGIN  
   DROP TABLE IF EXISTS temp_table;
   CREATE TEMPORARY TABLE temp_table (count int);

   insert into temp_table 
   select max(seq) 
   from livefeed.TMP_LIVEFEED 
   group by ProductID;

   SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

   SELECT minute(aa.UpdateOn) - minute(aa.TickTime), aa.* 
   FROM livefeed.TMP_LIVEFEED aa 
   where aa.seq in (select count from temp_table);

    SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
END // 
delimiter ;
于 2013-10-03T06:04:37.420 回答