它是否等同于mysql中的oracle游标参数功能?

时间:2013-02-07 08:57:30

标签: mysql cursor

它是否等同于MySQL中的ORACLE游标参数功能?

例如: -

CURSOR cursorname(paramter_name datatype) IS SELECT * FROM TABLE_NAME;

2 个答案:

答案 0 :(得分:0)

您可以尝试以下操作:

CURSOR select_curs IS SELECT * FROM tbl WHERE id = @id;

set @id = 1;
OPEN  ..
FETCH ..
CLOSE ..

答案 1 :(得分:0)

像这样:

该过程使用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;