各位高人,帮忙看看,这个问题以及感折磨了我好久,感觉我的程序都没有问题,可是每回执行到这都提示参数个数或类型错误。
存储过程:create or replace procedure LT_lendbook_new(
cert_id  VARCHAR2 ,
prop_no  VARCHAR2 ,
ret_datetime  CHAR ,
rule_no  VARCHAR2 ,
attach  VARCHAR2 ,
resp_wkr  VARCHAR2,
preg_flag CHAR,
rele_flag CHAR,
copy_flag  CHAR default 0,
lend_loca  char )
AS
location  VARCHAR2(5);
call_no  VARCHAR2(40);
marcrecno VARCHAR2(10);
clsid VARCHAR2(2);
sys_datetime  CHAR(18);
BEGIN
LT_lendbook_new.sys_datetime :=  TO_CHAR(SYSDATE, 'yyyy-mm-ddhh24:mi:ss');
UPDATE item
SET call_no = call_no
WHERE prop_no = LT_lendbook_new.prop_no; SELECT location, call_no, marc_rec_no
INTO LT_lendbook_new.location, LT_lendbook_new.call_no, LT_lendbook_new.marcrecno
FROM item
WHERE prop_no = LT_lendbook_new.prop_no; SELECT cls_id
INTO LT_lendbook_new.clsid
FROM call_no_lst
WHERE call_no = LT_lendbook_new.call_no; update preg_arri_lst set pregarri_deal_flag = '1'
WHERE cert_id = LT_lendbook_new.cert_id
and prop_no = LT_lendbook_new.prop_no
                and pregarri_deal_flag = '0'; update preg_lst set preg_flag = '1'
WHERE call_no = LT_lendbook_new.call_no
AND cert_id = LT_lendbook_new.cert_id
                and preg_flag = '0'; INSERT INTO lend_lst (cert_id,
prop_no,
lend_date,
norm_ret_date,
rule_no_f,
resp_wkr,
location_f,
attachment)
VALUES (LT_lendbook_new.cert_id,
LT_lendbook_new.prop_no,
LT_lendbook_new.sys_datetime,
LT_lendbook_new.ret_datetime,
LT_lendbook_new.rule_no,
LT_lendbook_new.resp_wkr,
LT_lendbook_new.location,
LT_lendbook_new.attach); INSERT INTO lend_hist (cert_id_f,
prop_no_f,
lend_date,
rule_no_f,
resp_wkr,
location_f,
marc_rec_no_f,
call_no,
cls_id,
attachment,
preg_flag,
rele_flag,
copy_flag,
code1)
VALUES (LT_lendbook_new.cert_id,
LT_lendbook_new.prop_no,
LT_lendbook_new.sys_datetime,
LT_lendbook_new.rule_no,
LT_lendbook_new.resp_wkr,
LT_lendbook_new.location,
LT_lendbook_new.marcrecno,
LT_lendbook_new.call_no,
LT_lendbook_new.clsid,
LT_lendbook_new.attach,
LT_lendbook_new.preg_flag,
LT_lendbook_new.rele_flag,
LT_lendbook_new.copy_flag,
LT_lendbook_new.lend_loca); UPDATE reader
SET total_lend_qty = total_lend_qty + 1,
year_lend_qty = year_lend_qty + 1
WHERE cert_id = LT_lendbook_new.cert_id;
UPDATE item
SET FST_USE_DATE = LT_lendbook_new.sys_datetime
WHERE prop_no = LT_lendbook_new.prop_no
AND total_circ_times = '0';
UPDATE item
SET total_circ_times = total_circ_times + 1,
year_circ_times = year_circ_times + 1,
last_use_date = LT_lendbook_new.sys_datetime,
book_lend_flag = '1'
WHERE prop_no = LT_lendbook_new.prop_no;
UPDATE call_no_lst
SET total_circ_times = total_circ_times + 1,
year_circ_times = year_circ_times + 1
WHERE call_no = LT_lendbook_new.call_no;END LT_lendbook_new;调用相关代码:
public void doLendBook(final String certID, final String propNo, final String retDate,
final String ruleNo, final String worker) {
runException.info("doLendBook.certID="+certID+",propNo="+propNo+",retDate="+retDate+",worker="+worker+"END");
//调用存储过程LT_lendbook_new
this.getJdbcTemplate().call(new CallableStatementCreator(){
public CallableStatement createCallableStatement(Connection conn)
throws SQLException {
CallableStatement cs = conn.prepareCall("call LT_lendbook_new(?,?,?,?,?,?,?,?,?,?)");
cs.setString(1,certID);
cs.setString(2,propNo);
cs.setString(3,retDate);
cs.setString(4,ruleNo);
cs.setString(5,null);
cs.setString(6,worker);
cs.setString(7,"0");
cs.setString(8,"0");
// cs.setString(9,"0");
cs.setString(10,"888");
return cs;
}
}, new ArrayList());
程序每次执行到这都提示参数个数或类型错误,晕死了,开始以为是cs.setString(5,null);这个赋NULL不行,后来改成“”还是不行
说明:在oracle的客户端执行存储过程没问题, 字符串长度也没有超长,下面是我打印出来的相关变量的值
doLendBook.certID=2009061211,propNo=00789345,retDate=2010-04-11,ruleNo=0000000002,worker=0416

解决方案 »

  1.   

    cs.setString(1,certID);
    这个默认是从1开始的吗?不太记得了,但一般都是从0开始的啊
      

  2.   

    调用Oracle的存储过程还没用过呢
      

  3.   

    char值好像是用''吧, 不是""哦
      

  4.   

    oracle里没有字符的说法,只有字符串的
      

  5.   

    你的参数“retDate”在JAVA调用执行的时候是不是Calendar类型的,你传的是日期类型的参数,而存储过程接收的是CHAR类型的
      

  6.   

    retDate是String的,没有问题,看错了...
    这一行为什么要注释掉呢?注释掉,参数不就少了吗?
    //cs.setString(9,"0");
      

  7.   

    //cs.setString(9,"0");
    这行是手误程序里是没有注释掉的