I have a stored procedure like this :
DROP PROCEDURE IF EXISTS storedprocedure;
CREATE DEFINER = 'userid'#'%' PROCEDURE storedprocedure
(IN id int)
BEGIN
DECLARE cor int;
DECLARE sup int;
DECLARE faktur varchar(20);
DECLARE ptgs int;
DECLARE suppli varchar(50);
DECLARE bag int;
DECLARE brg int;
DECLARE qty int;
DECLARE beli int;
DECLARE net int;
DECLARE oldbeli int;
DECLARE oldnet int;
DECLARE updhrg int;
DECLARE ket varchar(100);
DECLARE idsisa int;
DECLARE qtyterima int;
DECLARE qtysisa int;
DECLARE no_more_rows BOOLEAN;
DECLARE loop_cntr INT DEFAULT 0;
DECLARE num_rows INT DEFAULT 0;
DECLARE hitung CURSOR FOR
SELECT
aptlog_orderterima.corp,
aptlog_orderterima.idsupplier,
aptlog_orderterima.faktur,
aptlog_orderterima.idpetugas,
aptlog_supplier.supplier,
aptlog_orderterima.idbagian,
aptlog_orderterimadetail.idbarang,
aptlog_orderterimadetail.beli,
aptlog_orderterimadetail.net,
aptlog_orderterimadetail.qty,
aptlog_barang.beli,
aptlog_barang.net,
aptlog_barang.updatehrg,
CONCAT(aptlog_orderterima.faktur,' From : ',aptlog_supplier.supplier)
FROM
aptlog_orderterima
RIGHT OUTER JOIN aptlog_orderterimadetail ON (aptlog_orderterima.id = aptlog_orderterimadetail.idterima)
LEFT OUTER JOIN aptlog_supplier ON (aptlog_orderterima.idsupplier = aptlog_supplier.id)
LEFT OUTER JOIN aptlog_barang ON (aptlog_orderterimadetail.idbarang = aptlog_barang.id)
WHERE
aptlog_orderterima.id = id;
DECLARE sisaorder CURSOR FOR
SELECT
aptlog_orderdetail.id,
aptlog_orderdetail.qtyterima,
aptlog_orderdetail.sisa
FROM
aptlog_orderdetail
LEFT OUTER JOIN aptlog_order ON (aptlog_orderdetail.idorder = aptlog_order.id)
WHERE
aptlog_order.corp=cor AND
aptlog_order.stat=2 AND
aptlog_order.idsupplier=sup AND
CAST(aptlog_order.waktu AS DATE) >= CURDATE()-(SELECT pengadaan_param.nilai FROM pengadaan_param WHERE pengadaan_param.id=2) AND
aptlog_orderdetail.sisa<>0 AND
aptlog_orderdetail.idbarang=brg
ORDER BY
aptlog_order.waktu
LIMIT 1;
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET no_more_rows = TRUE;
OPEN hitung;
SELECT FOUND_ROWS() INTO num_rows;
the_loop: LOOP
FETCH hitung INTO cor, sup, faktur, ptgs, suppli, bag, brg, beli, net, qty, oldbeli, oldnet, updhrg, ket;
IF no_more_rows THEN CLOSE hitung; LEAVE the_loop;
END IF;
SET #awal = (SELECT aptlog_stok.qty FROM aptlog_stok WHERE corp=cor AND idbarang=brg AND idbagian=bag);
IF #awal IS NOT NULL THEN
UPDATE aptlog_stok SET aptlog_stok.qty = #awal + qty
WHERE corp=cor AND idbarang=brg AND idbagian=bag;
INSERT INTO aptlog_kartustok(waktu, corp, idbagian, idbarang, qtymasuk, qtykeluar, qtysisa, idpetugas, ket)
VALUES (now(), cor, bag, brg, qty, 0, #awal + qty, ptgs, ket); ELSE
INSERT INTO aptlog_stok(corp, idbarang, idbagian, qty)
VALUES (cor, brg, bag, qty);
INSERT INTO aptlog_kartustok(waktu, corp, idbagian, idbarang, qtymasuk, qtykeluar, qtysisa, idpetugas, ket)
VALUES (now(), cor, bag, brg, qty, 0, qty, ptgs, ket);
END IF;
IF updhrg=0 THEN
UPDATE aptlog_barang SET
aptlog_barang.beli=beli,
aptlog_barang.net=net,
aptlog_barang.updatehrg=1,
aptlog_barang.ubahharga=ket,
aptlog_barang.waktuubah=now(),
aptlog_barang.idpetugasubah=ptgs
WHERE
aptlog_barang.id=brg; ELSE
IF (updhrg=1) AND (beli > oldbeli) THEN
UPDATE aptlog_barang SET
aptlog_barang.beli=beli,
aptlog_barang.belilama=oldbeli,
aptlog_barang.net=net,
aptlog_barang.netlama=oldnet,
aptlog_barang.ubahharga=ket,
aptlog_barang.waktuubah=now(),
aptlog_barang.idpetugasubah=ptgs
WHERE
aptlog_barang.id=brg; END IF;
END IF;
SET #qty=qty;
sisa_order: LOOP
OPEN sisaorder;
FETCH sisaorder INTO idsisa, qtyterima, qtysisa;
IF #qty=0 THEN CLOSE sisaorder; LEAVE sisa_order;
END IF;
IF #qty <> 0 THEN
IF qtysisa > #qty THEN
UPDATE aptlog_orderdetail SET
aptlog_orderdetail.qtyterima=qtyterima+#qty,
aptlog_orderdetail.sisa=qtysisa-#qty
WHERE
aptlog_orderdetail.id=idsisa;
SET #qty=0;
ELSE
UPDATE aptlog_orderdetail SET
aptlog_orderdetail.qtyterima=qtyterima+qtysisa,
aptlog_orderdetail.sisa=0
WHERE
aptlog_orderdetail.id=idsisa;
SET #qty = #qty-qtysisa;
END IF;
END IF;
CLOSE sisaorder;
END LOOP sisa_order;
SET loop_cntr = loop_cntr + 1;
END LOOP the_loop;
END');
My question :
The second loop work perfectly, but the first loop just work once.
But if I remove this line "CAST(aptlog_order.waktu AS DATE) >= CURDATE()-(SELECT pengadaan_param.nilai FROM pengadaan_param WHERE pengadaan_param.id=2) AND" from sisaorder all loop work perfectly...
So can anybody help me?
Related
THE CURSOR IS NOT GOING TO THE ELSE STATEMENT. WHAT AM I DOING WRONG? HOW CAN I DEBUG IN MYSQL ?
I am trying to get the list of task Ids with null values and then for each taskID, I am calling a SP to create start data and due date of the missing tasks(greater than the max(start_date available) until the current_date
DROP PROCEDURE IF EXISTS zcursor_ADDTA1;
DELIMITER ;;
CREATE PROCEDURE zcursor_ADDTA1(
#out retCount int
)
BEGIN
#DECLARE C_ID INT;
DECLARE C_TASK_ID INT;
DECLARE C_pattern varchar(100);
DECLARE C_REM INT;
DECLARE ACT_T_STTM VARCHAR(100);
DECLARE ACT_T_DTTM VARCHAR(100);
DECLARE TZ VARCHAR(100);
DECLARE T_STDT DATE;
DECLARE T_EXDT DATE;
DECLARE retCount INT;
DECLARE done INT DEFAULT FALSE;
DECLARE TA_MAX_ST_DT DATE;
#DECLARE P1 INT;
DECLARE cursor_i CURSOR FOR SELECT TASK_ID, PATTERN, reminder_days_before, ACTUAL_TASK_START_TIME,ACTUAL_TASK_DUE_TIME,TIMEZONE,
START_DT,EXP_DT FROM OCC_ML_TASK_RECURRENCE TR WHERE PATTERN = 'DAILY' AND CALENDAR_TYPE='' AND IS_CANCELED =0 AND EXP_DT>CURRENT_DATE();
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
SET retCount = 0;
OPEN cursor_i;
read_loop: LOOP
FETCH NEXT FROM cursor_i INTO C_TASK_ID,C_pattern,C_REM,ACT_T_STTM,ACT_T_DTTM,
TZ,T_STDT,T_EXDT;
IF done THEN
LEAVE read_loop;
ELSE
SELECT MAX(TA.START_DTM)FROM
OCC_ML_TASK_ACTIVITY TA
WHERE TA.TASK_ID=C_TASK_ID INTO TA_MAX_ST_DT;
SELECT DATE_ADD(TA_MAX_ST_DT,INTERVAL 1 DAY) INTO TA_MAX_ST_DT;
WHILE (TA_MAX_ST_DT<=CURRENT_DATE())
DO
BEGIN
IF WEEKDAY(TA_MAX_ST_DT)=4 THEN
CALL ZTA_MISSINGDATA_INSERT(C_TASK_ID ,TA_MAX_ST_DT);
SELECT DATE_ADD(TA_MAX_ST_DT,INTERVAL 3 DAY)INTO TA_MAX_ST_DT;
ELSEIF WEEKDAY(TA_MAX_ST_DT)=5 THEN
#"NO INSERT "
SELECT DATE_ADD(TA_MAX_ST_DT,INTERVAL 2 DAY)INTO TA_MAX_ST_DT;
ELSEIF WEEKDAY(TA_MAX_ST_DT)=6 THEN
#"NO INSERT "
SELECT DATE_ADD(TA_MAX_ST_DT,INTERVAL 1 DAY)INTO TA_MAX_ST_DT;
ELSE
CALL ZTA_MISSINGDATA_INSERT(C_TASK_ID ,TA_MAX_ST_DT);
SELECT DATE_ADD(TA_MAX_ST_DT,INTERVAL 1 DAY) INTO TA_MAX_ST_DT;
END IF;
END;
END WHILE;
END IF;
END LOOP;
CLOSE cursor_i;
END;
;;
Below procedure code running with out error . Line select FOUND_ROWS() returning n no. rows but cursor curs did not loop all rows
CREATE DEFINER=`root`#`%` PROCEDURE `middleLocationAutoUpdatePorc`()
BEGIN
declare vname varchar(45);
declare vmobile varchar(20);
declare vsapid varchar(6);
declare vuser varchar(45);
declare vday date;
declare vmintime time;
declare vmaxtime time;
declare vminLocation mediumtext;
declare vmaxLocation mediumtext;
declare vmiddlelocation mediumtext;
declare vdistance int(11);
declare vdrdid int(11);
declare vn_no_details int(11);
declare uatt varchar(45) default 'X';
declare adatta varchar(45) default 'X';
declare b_not_found BOOL DEFAULT FALSE;
declare curs CURSOR FOR
SELECT user ,day, mintime,maxtime_mobile,minLocation,maxLocation,distance,n_no_details,drdid FROM mydb.statusreport where day >= '2017-06-26';
DECLARE CONTINUE HANDLER FOR NOT FOUND SET b_not_found = true;
OPEN curs;
loop1: LOOP
FETCH curs INTO vuser,vday,vmintime,vmaxtime,vminLocation,vmaxLocation,vdistance,vn_no_details,vdrdid;
IF b_not_found THEN
LEAVE loop1;
END IF;
-- select FOUND_ROWS();
case substring_index(vuser,"-",-1)
when 'RSM' then
select username,Name,mobile into vsapid,vname,vmobile from mydb.supervisor where idSu=CONVERT(substring_index(vuser,"-",1),UNSIGNED INTEGER);
when 'ASM' then
select userName,name,mobile into vsapid,vname,vmobile from mydb.executive where exeid=CONVERT(substring_index(vuser,"-",1),UNSIGNED INTEGER);
when 'F' then
select sapId,name,phone into vsapid,vname,vmobile from mydb.user where idUser=CONVERT(substring_index(vuser,"-",1),UNSIGNED INTEGER);
end case;
select userGiven , adminGiven into uatt ,adatta from userdaystatus st where st.date =vday and st.idUser=CONVERT(substring_index(vuser,"-",1),UNSIGNED INTEGER) and st.userType=substring_index(vuser,"-",-1);
set vmiddlelocation=( select location from mydb.dailyReportDetails as dtb where dtb.idDailyReport=vdrdid and dtb.counter>=(abs(vn_no_details/2) ) order by dtb.idDailyReportDetails asc limit 1);
call mydb.addOMiddleLocation(day(vday), month(vday),
year(vday),vuser, vname,
vsapid, vmobile, vmintime,
vmaxtime, SUBTIME(vmaxtime,vmintime),
vminLocation,
vmiddlelocation,
vmaxLocation,Round(vdistance/1000,2),
uatt, adatta);
END LOOP;
CLOSE curs;
END
The Procedure call mydb.addOMiddleLocation() just inserting Row on another table.There does not have any data type validation .
So what can be the problem ?
It happen for log wait time for a particular Query line
set vmiddlelocation=( select location from mydb.dailyReportDetails as dtb where dtb.idDailyReport=vdrdid and dtb.counter>=(abs(vn_no_details/2) ) order by dtb.idDailyReportDetails asc limit 1);
This is the first time I am working on Mysql stored procedure I know it is a lame question please spare me for this,
is it not possible to print any value after the END LOOP statement in MySQL procedure. If it is, how we can achieve this.
what I did for this:
BEGIN
DECLARE U_movingCity varchar(50);
DECLARE U_state varchar(50);
DECLARE U_education varchar(50);
DECLARE id2 int(10);
DECLARE RankPoint int(10) DEFAULT 0;
DECLARE movingCity2 varchar(50);
DECLARE state2 varchar(50);
DECLARE education2 varchar(50);
DECLARE cur1 CURSOR FOR SELECT id, state , education FROM user WHERE id != userid AND Enabled='y' AND Active='y';
SELECT state , education into U_state , U_education FROM user WHERE id = userid ;
OPEN cur1;
read_loop: LOOP
SET RankPoint := 0;
FETCH cur1 INTO id2, state2 , education2 ;
IF ((state2 = U_state)) THEN
SET RankPoint := RankPoint + 14;
END IF;
IF ((education2 = U_education)) THEN
SET RankPoint := RankPoint + 16;
END IF;
//this displays
select RankPoint;
END LOOP;
//this doesn't.
select id, RankPoint from user;
CLOSE cur1;
END
You should use id2 instead of id in your last query.
select `id2`, `RankPoint` from `user`;
So,
I am facing a problem here, that is makeing me crazy, I think this is a stupid error, so I am not a newbie in MySQL but its not working like I think.
After try to deploy this statment to MySQL I got this Erro:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEClARE estoque CURSOR FOR
SELECT
validade,
' at line 26
Here is my SP
DROP PROCEDURE IF EXISTS SP_SEPARA_MATERIAL;
DELIMITER $$
CREATE PROCEDURE SP_SEPARA_MATERIAL(IN MovimentoItemPedidoID INT(11))
BEGIN
DECLARE EMPRESA_ID int;
DECLARE MOVIMENTO_ID int;
DECLARE ARMAZEM_ID int;
DECLARE CLIENTE_ID int;
DECLARE FLUXO_LOGISTICO_ID int;
DECLARE PRODUTO_ID int;
DECLARE VOLUME_ID int;
DECLARE VALIDADE date;
DECLARE LOTE int;
DECLARE NOTA int;
DECLARE PRECO double;
DECLARE QTD_BOM double;
DECLARE QTD_RUIM double;
DECLARE ESTOQUE_BOM double;
DECLARE ESTOQUE_RUIM double;
DECLARE RET_BOM double;
DECLARE RET_RUIM double;
DECLARE finished INTEGER DEFAULT 0;
-- Catch head data of move
SELECT movimento_id, fluxo_logistico_id, produto_id, quantidade_bom, quantidade_ruim INTO MOVIMENTO_ID, FLUXO_LOGISTICO_ID, PRODUTO_ID, QTD_BOM, QTD_RUIM FROM movimento_itens_pedido WHERE id = MovimentoItemPedidoID;
SELECT empresa_id, cliente_id, armazem_id INTO EMPRESA_ID, CLIENTE_ID, ARMAZEM_ID FROM movimento WHERE id = MOVIMENTO_ID;
DEClARE estoque CURSOR FOR
SELECT
validade,
lote_numero,
nota_numero,
preco_unitario,
volume_id,
quantidade_bom,
quantidade_ruim
FROM
estoque_enderecado_reserva_picking
WHERE
empresa_id = EMPRESA_ID AND
armazem_id = ARMAZEM_ID AND
cliente_id = CLIENTE_ID AND
produto_id = PRODUTO_ID AND
(quantidade_bom>=0 OR quantidade_ruim>=0);
DECLARE CONTINUE HANDLER FOR NOT FOUND SET finished = 1;
OPEN estoque;
loop_separacao: LOOP
FETCH estoque INTO
VALIDADE,
LOTE,
NOTA,
PRECO,
VOLUME_ID,
ESTOQUE_BOM,
ESTOQUE_RUIM;
IF finished = 1 THEN
LEAVE loop_separacao;
END IF;
IF QTD_BOM>0 AND ESTOQUE_BOM>0 THEN
SET RET_BOM = 0;
IF ESTOQUE_BOM>=QTD_BOM THEN
SET RET_BOM = QTD_BOM;
ELSE
SET RET_BOM = ESTOQUE_BOM;
END IF;
END IF;
IF QTD_RUIM>0 AND ESTOQUE_RUIM>0 THEN
SET RET_RUIM = 0;
IF ESTOQUE_RUIM>=QTD_RUIM THEN
SET RET_RUIM = QTD_RUIM;
ELSE
SET RET_RUIM = ESTOQUE_RUIM;
END IF;
END IF;
IF RET_BOM>0 OR RET_RUIM>0 THEN
INSERT INTO movimento_picking_volume_itens (movimento_id,armazem_id,cliente_id,fluxo_logistico_id,produto_id,quantidade_bom,quantidade_ruim,validade,lote_numero,nota_numero,preco_unitario,volume_id)
VALUES (MOVIMENTO_ID,ARMAZEM_ID,CLIENTE_ID,FLUXO_LOGISTICO_ID,PRODUTO_ID,RET_BOM,RET_RUIM,VALIDADE,LOTE,NOTA,PRECO,VOLUME_ID);
SET QTD_BOM = (QTD_BOM - RET_BOM);
SET QTD_RUIM = (QTD_RUIM - RET_RUIM);
END IF;
IF QTD_BOM=0 AND QTD_RUIM=0 THEN
SET finished = 1;
LEAVE loop_separacao;
END IF;
END LOOP loop_separacao;
CLOSE estoque;
END $$
DELIMITER ;
Check: 13.6.6.2 Cursor DECLARE Syntax
...
Cursor declarations must appear before handler declarations and after
variable and condition declarations.
...
Try:
DROP PROCEDURE IF EXISTS SP_SEPARA_MATERIAL;
DELIMITER $$
CREATE PROCEDURE SP_SEPARA_MATERIAL(IN MovimentoItemPedidoID INT(11))
BEGIN
DECLARE EMPRESA_ID int;
DECLARE MOVIMENTO_ID int;
DECLARE ARMAZEM_ID int;
DECLARE CLIENTE_ID int;
DECLARE FLUXO_LOGISTICO_ID int;
DECLARE PRODUTO_ID int;
DECLARE VOLUME_ID int;
DECLARE VALIDADE date;
DECLARE LOTE int;
DECLARE NOTA int;
DECLARE PRECO double;
DECLARE QTD_BOM double;
DECLARE QTD_RUIM double;
DECLARE ESTOQUE_BOM double;
DECLARE ESTOQUE_RUIM double;
DECLARE RET_BOM double;
DECLARE RET_RUIM double;
DECLARE finished INTEGER DEFAULT 0;
/* MOVE AFTER THE DECLARE CONTINUE HANDLER ...
-- Catch head data of move
SELECT movimento_id, fluxo_logistico_id, produto_id, quantidade_bom, quantidade_ruim INTO MOVIMENTO_ID, FLUXO_LOGISTICO_ID, PRODUTO_ID, QTD_BOM, QTD_RUIM FROM movimento_itens_pedido WHERE id = MovimentoItemPedidoID;
SELECT empresa_id, cliente_id, armazem_id INTO EMPRESA_ID, CLIENTE_ID, ARMAZEM_ID FROM movimento WHERE id = MOVIMENTO_ID;
MOVE AFTER THE DECLARE CONTINUE HANDLER ... */
DEClARE estoque CURSOR FOR
SELECT
validade,
lote_numero,
nota_numero,
preco_unitario,
volume_id,
quantidade_bom,
quantidade_ruim
FROM
estoque_enderecado_reserva_picking
WHERE
empresa_id = EMPRESA_ID AND
armazem_id = ARMAZEM_ID AND
cliente_id = CLIENTE_ID AND
produto_id = PRODUTO_ID AND
(quantidade_bom>=0 OR quantidade_ruim>=0);
DECLARE CONTINUE HANDLER FOR NOT FOUND SET finished = 1;
-- Catch head data of move
SELECT movimento_id, fluxo_logistico_id, produto_id, quantidade_bom, quantidade_ruim INTO MOVIMENTO_ID, FLUXO_LOGISTICO_ID, PRODUTO_ID, QTD_BOM, QTD_RUIM FROM movimento_itens_pedido WHERE id = MovimentoItemPedidoID;
SELECT empresa_id, cliente_id, armazem_id INTO EMPRESA_ID, CLIENTE_ID, ARMAZEM_ID FROM movimento WHERE id = MOVIMENTO_ID;
OPEN estoque;
loop_separacao: LOOP
FETCH estoque INTO
VALIDADE,
LOTE,
NOTA,
PRECO,
VOLUME_ID,
ESTOQUE_BOM,
ESTOQUE_RUIM;
IF finished = 1 THEN
LEAVE loop_separacao;
END IF;
IF QTD_BOM>0 AND ESTOQUE_BOM>0 THEN
SET RET_BOM = 0;
IF ESTOQUE_BOM>=QTD_BOM THEN
SET RET_BOM = QTD_BOM;
ELSE
SET RET_BOM = ESTOQUE_BOM;
END IF;
END IF;
IF QTD_RUIM>0 AND ESTOQUE_RUIM>0 THEN
SET RET_RUIM = 0;
IF ESTOQUE_RUIM>=QTD_RUIM THEN
SET RET_RUIM = QTD_RUIM;
ELSE
SET RET_RUIM = ESTOQUE_RUIM;
END IF;
END IF;
IF RET_BOM>0 OR RET_RUIM>0 THEN
INSERT INTO movimento_picking_volume_itens (movimento_id,armazem_id,cliente_id,fluxo_logistico_id,produto_id,quantidade_bom,quantidade_ruim,validade,lote_numero,nota_numero,preco_unitario,volume_id)
VALUES (MOVIMENTO_ID,ARMAZEM_ID,CLIENTE_ID,FLUXO_LOGISTICO_ID,PRODUTO_ID,RET_BOM,RET_RUIM,VALIDADE,LOTE,NOTA,PRECO,VOLUME_ID);
SET QTD_BOM = (QTD_BOM - RET_BOM);
SET QTD_RUIM = (QTD_RUIM - RET_RUIM);
END IF;
IF QTD_BOM=0 AND QTD_RUIM=0 THEN
SET finished = 1;
LEAVE loop_separacao;
END IF;
END LOOP loop_separacao;
CLOSE estoque;
END $$
DELIMITER ;
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_type_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