开发者

Operand should contain 1 column(s) stored procedure

I was trying use multiple select at one procedure to assign the value of variable. but i got error like this "Operand should contain 1 column(s)" this is my 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 FOR
  select a.cust_id, a.avail_balance, a.product_cd, p.product_ty开发者_如何学JAVApe_cd
  from account a, product p
   where a.product_cd = p.product_cd;
  DECLARE CONTINUE HANDLER FOR NOT FOUND SET no_more_rows = 1;

  OPEN col_cur;
  select FOUND_ROWS() into num_rows;

  read_loop: LOOP
  IF no_more_rows THEN
  CLOSE col_cur;
  LEAVE read_loop;
  END IF;
  FETCH col_cur INTO idcust_val, balance_val, productCd_val, productType_val;
  SELECT idcust_val, balance_val, productCd_val;
    IF productType_val = 'ACCOUNT' THEN
      IF productCd_val = 'SAV' || productCd_val = 'CD' THEN
        IF balance_val < 2000 THEN
              SELECT (balance_val-10) INTO balance_val;
        END IF;
      ELSE
        SELECT (balance_val+(balance_val*0,05)) INTO balance_val;
      END IF;
     ELSE
      SELECT (balance_val-(balance_val*0,1)) INTO balance_val;
    END IF;
  /*UPDATE account SET avail_balance = balance_val WHERE account_id = idcust_val;*/
  END LOOP read_loop;
END $$
DELIMITER ;

please help!


Change decimal point ',' to '.'

0,05 -> 0.05
0,1 - 0.1
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜