title: cursore within prusider mysql
body: <p>i'm trying to slice a long double Column by Varied size , and insert it with cursor to new table that has this size of columns amount.
  the trouble is the cursor isn't responding?
  I tried to activate the cursor (Externally) manually And managed to.
  So I have the impression cursor does not work within procedure?!
  <strong>Here's the code:
  The outer procedure:</strong></p>
  
  <pre><code>CREATE DEFINER=`root`@`localhost` PROCEDURE `slice_arrays`(IN `size` INT)
      DETERMINISTIC
  BEGIN
  DECLARE n INT DEFAULT 0;
  DECLARE h INT DEFAULT 0;
  DECLARE q_creat text DEFAULT "";
  DECLARE cell text DEFAULT "cell";
  DECLARE cell_type text DEFAULT "double";
  DECLARE new_table_name text DEFAULT "";
  
  set new_table_name=CONCAT("table_1440_slice_by_",size);
  SELECT COUNT(*) FROM eurusd_1440_minute_timeframe_chart_bars INTO n;
  SET @q_creat =CONCAT("CREATE TABLE  IF NOT EXISTS ",new_table_name," (");
  
  
  
  WHILE h &lt; size DO
  SET @q_creat =   CONCAT(@q_creat,cell,h," ",cell_type);
  
  set @h_pluse_1=h+1;
  if  @h_pluse_1 = size THEN 
  SET @q_creat= CONCAT(@q_creat,")");
  else 
  SET @q_creat= CONCAT(@q_creat,",");
  end if;
  
  set h=h+1;
  END WHILE;
  
  PREPARE stmt1 FROM @q_creat;
  
  
  
  
  EXECUTE stmt1;
  
  DEALLOCATE PREPARE stmt1;
  
  
  
  TRUNCATE TABLE new_table_name;
  set h=0;
  
  
  
  
  
  set @temp_cuonter=size;
  
  WHILE @temp_cuonter &lt;= n DO
  
  
  
  drop table IF EXISTS temp_table;
  
  
  create table temp_table as (SELECT * FROM table_1440_test3  LIMIT h , size);
  
  
  
  CALL insert_into_selected_table_from_temp_table(new_table_name);
  
   set h=h+1;
   set @temp_cuonter =@temp_cuonter+1;
  
  
  TRUNCATE TABLE tamp_table;
  
  end while;
  
  
  
  End
  </code></pre>
  
  <p><strong>The nested procedure:</strong></p>
  
  <pre><code>CREATE DEFINER=`root`@`localhost` PROCEDURE `insert_into_selected_table_from_temp_table`(IN `table_name` TEXT)
      DETERMINISTIC
  begin
  set @insert_q= CONCAT("INSERT INTO ",table_name," VALUES("); 
  
  
  
  
  
  
  set @insert_q= CONCAT(@insert_q,get_temp_table(),")"); 
  
  PREPARE stmt2 FROM @insert_q;
  EXECUTE stmt2;
  DEALLOCATE PREPARE stmt2;
   end
  </code></pre>
  
  <p><strong>thanks!</strong></p>