Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1.  
  2. delimiter $
  3. create procedure p2(IN email VARCHAR(256))
  4. begin
  5.  
  6. declare article_path VARCHAR(256);
  7. declare nfm1 INT;
  8. declare cursor1 cursor for select art_path from signed where sgn_jrn_email=email;
  9.  
  10. declare continue handler for not found set nfm1=1;
  11.  
  12. open cursor1;
  13. set nfm1=0;
  14.  
  15. repeat
  16. declare nfm2 INT;
  17. fetch cursor1 into article_path;
  18. declare cursor2 cursor for select cat_id from belongs,category where bl_cat_id=cat_id and bl_art_path=article_path;
  19. declare continue handler for not found set nfm2=1;
  20. declare category_id INT;
  21. open cursor2;
  22. set nfm2=0;
  23.  
  24. repeat
  25. fetch cursor2 into category_id;
  26. select cat_name from category where cat_id=category_id;
  27.  
  28. select bl_art_path,art_title from belongs,category,article,signed where bl_cat_id=category_id and bl_art_path=art_path and sgn_art_path=art_path and sgn_jrn_email=email;
  29. until(nfm2=1)
  30. end repeat;
  31. close cursor2;
  32. until(nfm1=1)
  33. end repeat;
  34. close cursor1;
  35. end$
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'declare nfm2 INT;
  43. fetch cursor1 INTO article_path;
  44. declare cursor2 cursor fo' at line 14
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement