【问题标题】:How to use Bind Variables in Informix Procedure如何在 Informix 过程中使用绑定变量
【发布时间】:2018-03-21 21:09:15
【问题描述】:

我正在尝试将绑定变量用于 Informix 过程。 有人可以指导我如何使用以下程序吗?
创建过程 neura_omega_stg.grn_payment_mode_update(vv_material_document_id Varchar(20),vv_payment_mode Varchar(10))

更新 goods_receive_header_tbl SET payment_mode=vv_payment_mode WHERE material_document_id=vv_material_document_id;

结束程序;

【问题讨论】:

    标签: informix


    【解决方案1】:

    如果您使用 Java 等 JVM 语言,或者可以使用 Informix JDBC 驱动程序的 Jython,那么您可以使用 CallableStatement:

    proc = db.prepareCall("{ call neura_omega_stg.grn_payment_mode_update(?, ?) }")
    proc.setString(1, "10")
    proc.setString(2, "20")
    proc.execute();
    

    在 JDBC/ODBC 中你可以使用 Prepared Statement:

    pstm = db.createStatement("EXECUTE PROCEDURE neura_omega_stg.grn_payment_mode_update(?, ?)")
    pstm.setString(1, "10")
    pstm.setString(2, "20")
    pstm.execute()
    

    【讨论】:

    • 我不在 Java 中工作。我想要 Informix 数据库。 (数据工作室)。
    【解决方案2】:

    大概在 Data Studio SQL 编辑器中,您会执行如下操作:

    EXECUTE PROCEDURE neura_omega_stg.grn_payment_mode_update("One", "Two");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-10-18
      • 1970-01-01
      • 2018-06-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-24
      • 1970-01-01
      相关资源
      最近更新 更多