Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

got error at two places

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

what is the correct syntax for stored procedure in this case?

share|improve this question
1  
third line : shouldn't it be "drop table" ? – Gar 21 hours ago

1 Answer

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 ;
share|improve this answer
how to use select * from p2 ? – user2827740 21 hours ago
i was about to answer :) Are we hunting the same issues @juergen d :) i upvoted it – Kay Nelson 21 hours ago
you have to write the code 'CALL p2()' – Kay Nelson 21 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.