它是 MySQL 中等效的 ORACLE 游标参数功能吗?
例如 :-
CURSOR cursorname(paramter_name datatype) IS SELECT * FROM TABLE_NAME;
您可以尝试以下方法:
CURSOR select_curs IS SELECT * FROM tbl WHERE id = @id;
set @id = 1;
OPEN ..
FETCH ..
CLOSE ..
像这样:
该过程使用 var_id_res 参数来指定特定的预留:
此过程参数用于控制光标仅选择对应的项目
CREATE PROCEDURE `UpdatePriceAndVatAndDiscountForReservationItems`(
IN var_id_res INTEGER
)
...to the reservation passed by the parameter:
-- the line reserve curosr
DECLARE cur_res CURSOR FOR
SELECT id_line
, id_prod
, disc_bool
, no_days
FROM line_reserve
WHERE id_res = var_id_res;