论坛首页 Java企业应用论坛

Ibatis中如何调用oracle存储的函数?

浏览 3736 次
该帖已经被评为隐藏帖
作者 正文
   发表时间:2007-06-22  
Ibatis中如何调用oracle存储的函数
如在oracle中有个package叫做PCK_VIEW,在PCK_VIEW里面有个F_GET_SITESNAPSHOT_TIME的函数有一个varchar2参数
-------------------------------------------
  function F_GET_PARTNER_LIST(p_tmp varchar2)
    return RecordSet
  is
    l_rs RecordSet;
  begin
    open l_rs for select partner from T_PARTNER  order by UPPER(partner) asc; 
    return l_rs;
  end F_GET_PARTNER_LIST;
-------------------------------------------
在ibatils里面配置调用是{ call PCK_VIEW.F_GET_SITESNAPSHOT_TIME(?) }
我确定参数都配置好了,但是调用的时候还是报错啊
-------------------------------------------
--- The error occurred in com/phoenixtv/stat/dao/ibatis/sql/realtime.xml. --- The error occurred while applying a parameter map. --- Check the stat.realtime.pm_in_getSiteSnapshotTime. --- Check the statement (update procedure failed). --- Cause: java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00221: 'F_GET_SITESNAPSHOT_TIME' is not a procedure or is undefined ORA-06550: line 1, column 7:
-------------------------------------------
怎么回事,明明数据库有这个函数啊?
但是我在jdbc中这段代码确可以调用
-------------------------------------------
            Class.forName("oracle.jdbc.driver.OracleDriver");  
            conn =DriverManager.getConnection("jdbc:oracle:thin:@111.111.111.111:1521:stat","pass","pass");
             


            //conn = DBConnection.ins.getConn("jdbc/StatDB");sdf.format(new Date())+1
            //conn = DBConnection.ins.getConn("statistic");

            cs = conn.prepareCall("{? = call PCK_VIEW.F_GET_SITESNAPSHOT_TIME(?)}");
            cs.registerOutParameter(1, OracleTypes.CURSOR);
            cs.setString(2,"");
            cs.execute();
            rs =(ResultSet) cs.getObject(1);
--------------------------------------------
   发表时间:2007-06-29  
输入输出参数也要配置
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics