开发者

how to pass cursor as IN parameter to a stored procedure

I want to pass a cursor to a stored procedure as IN parameter from my xyz.jav开发者_Python百科a file. I am using spring and hibernate. Can you help me with this. Needed urgently.Reply soon.

And if cannot pass then can you help with some alernative.

Thankyou.


Use Spring Stuff for calling Stored Procedure..

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);
    }
}

}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜