i trying use multiple select @ 1 procedure assign value of variable. got error "operand should contain 1 column(s)" code :
delimiter $$ drop procedure if exists `bankdb`.`charge` $$ create procedure `bankdb`.`charge` () begin declare idcust_val int; declare balance_val float; declare balance_val1 float; declare balance_val2 float; declare productcd_val varchar(10); declare producttype_val varchar(10); declare no_more_rows int default 0; declare num_rows int default 0; declare col_cur cursor select a.cust_id, a.avail_balance, a.product_cd, p.product_type_cd account a, product p a.product_cd = p.product_cd; declare continue handler not found set no_more_rows = 1; open col_cur; select found_rows() num_rows; read_loop: loop if no_more_rows close col_cur; leave read_loop; end if; fetch col_cur idcust_val, balance_val, productcd_val, producttype_val; select idcust_val, balance_val, productcd_val; if producttype_val = 'account' if productcd_val = 'sav' || productcd_val = 'cd' if balance_val < 2000 select (balance_val-10) balance_val; end if; else select (balance_val+(balance_val*0,05)) balance_val; end if; else select (balance_val-(balance_val*0,1)) balance_val; end if; /*update account set avail_balance = balance_val account_id = idcust_val;*/ end loop read_loop; end $$ delimiter ;
please help!
change decimal point ',' '.'
0,05 -> 0.05 0,1 - 0.1
Comments
Post a Comment