sql - mysql, iterate through column names -


i of column names mysql table, loop through each column name , run stored procedure using column names variable. effect of:

colnames = column names table  each colname   if changed       else     else 

it looks show columns mytable give me column names, how column names loop?

i run of in stored procedure using native sql. since i'm still learning intricacies of mysql, , out project. help.

i think want this:

declare col_names cursor   select column_name   information_schema.columns   table_name = 'tbl_name'   order ordinal_position;   select found_rows() num_rows;  set = 1; the_loop: loop     if > num_rows         close col_names;         leave the_loop;     end if;       fetch col_names      col_name;            //do whatever else need col name      set = + 1;   end loop the_loop; 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -