Unknown System Variable "no_more_data" at Mysql Stored Procedure -


i'm new using mysql stored procedure. there error can't fix code

delimiter $$  create procedure `bankdb`.`charge` ()  begin declare idcust_val int; declare balance_val float; declare productcd_val varchar(10);  declare loop_cntr int default 0; declare num_rows int default 0;  declare col_cur cursor select c.cust_id, c.balance, c.product_cd account c; declare continue handler not found set no_more_rows = true;  open col_cur; select found_rows() num_rows;  read_loop: loop fetch col_cur idcust_val, balance_val, productcd_val;  if no_more_rows close col_cur; leave read_loop; end if;  if productcd_val == 'sav' || productcd_val == 'cd'     if balance_val == 2000           balance_val = balance_val-10;           update account set avail_balance = balance_val           account_id =idcust_val;     end if; end if;  if productcd_val == 'chk' || productcd_val == 'sav' || productcd_val == 'mm' || productcd_val == 'cd'   balance_val = balance_val + (balance_val*0,05);   update account set avail_balance = balance_val   account_id =idcust_val; else   balance_val = balance_val - (balance_val*0,1);   update account set avail_balance = balance_val   account_id =idcust_val; end if;  set loop_cntr = loop_cntr + 1; end loop; end $$  delimiter ; 

when execute it, mysql query browser show error this:

script line: 3 unknown system variable 'no_more_rows'

please me!!

  1. a variable no_more_rows must delared, write next line @ begining of procedure's body.

    declare no_more_rows int default 0;

  2. equal operator '='

    if productcd_val == 'sav' , etc. should if productcd_val = 'sav'

  3. use set command assigns values, e.g. -

    set balance_val = balance_val - 10;


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -