【问题标题】:Is it equivalent oracle cursor parameter feature in mysql?它是mysql中等效的oracle游标参数功能吗?
【发布时间】:2013-02-07 08:57:30
【问题描述】:

是不是相当于 MySQL 中的 ORACLE 游标参数特性?

例如:-

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

【问题讨论】:

    标签: mysql cursor


    【解决方案1】:

    您可以尝试以下方法:

    CURSOR select_curs IS SELECT * FROM tbl WHERE id = @id;
    
    set @id = 1;
    OPEN  ..
    FETCH ..
    CLOSE ..
    

    【讨论】:

      【解决方案2】:

      像这样:

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

      【讨论】:

      • 我必须在参数中动态传递多个值。
      猜你喜欢
      • 2023-01-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-24
      • 2012-11-20
      • 1970-01-01
      • 2011-07-02
      相关资源
      最近更新 更多