【问题标题】:how to pass cursor as IN parameter to a stored procedure如何将游标作为 IN 参数传递给存储过程
【发布时间】:2010-07-14 12:03:18
【问题描述】:

我想将游标作为 xyz.java 文件中的 IN 参数传递给存储过程。 我正在使用弹簧和休眠。 你能帮我解决这个问题吗? 急需。尽快回复。

如果不能通过,那么你能帮忙解决一些问题吗?

谢谢。

【问题讨论】:

  • 您使用的是什么数据库,为什么要将游标传递给存储过程,您要做什么?

标签: hibernate spring stored-procedures


【解决方案1】:

使用 Spring Stuff 调用存储过程..

enter code here : public class MyStoredProcedure extends StoredProcedure {

public MyStoredProcedure(){
}
public MyStoredProcedure(DataSource ds) {
    this.setDataSource(ds);
    this.setSql("procedure name");
    this.declareParameter(new SqlParameter("param", Types.VARCHAR));
    this.compile();
}

public void callProcedure() {
    Map<String, String> inParams = new HashMap<String, String>();
    inParams.put("param", "Good");
    try {
        execute(inParams);
    } catch (Exception e) {
        System.out.println("Error Man : " + e);
    }
}


public static void main(String[] args) {
    DriverManagerDataSource dataSource new DriverManagerDataSource("Driver", "url", "uname", "upass");
    try{
    MyStoredProcedure procedure = new MyStoredProcedure(dataSource);
    procedure.callProcedure();
    }catch(Exception exception){
        System.out.println("Eroooorrror : "+exception);
    }
}

}

【讨论】:

    猜你喜欢
    • 2018-01-07
    • 2016-02-02
    • 1970-01-01
    • 2019-06-03
    • 1970-01-01
    • 2010-10-19
    • 1970-01-01
    • 1970-01-01
    • 2011-11-09
    相关资源
    最近更新 更多