尝试从Java代码调用存储的Oracle过程时,我得到ORA-06550

时间:2012-02-20 23:08:48

标签: java oracle

错误说明:

SEVERE: ORA-06550: line 1, column 7:
PLS-00103: Encountered the symbol "=" when expecting one of the following:

   ( begin case declare exit for goto if loop mod null pragma
   raise return select update while with <an identifier>
   <a double-quoted delimited-identifier> <a bind variable> <<
   continue close current delete fetch lock insert open rollback
   savepoint set sql execute commit forall merge pipe purge
The symbol "<an identifier>" was substituted for "=" to continue.

Java代码:

private String get_Supply_sector_emailid(int poNum) {
    String retString = null;

    try {

        ConnectionManager cm = ConnectionManager.getInstance();
        connection = cm.getConnection();

        // Are there any email ids registered in the contacts for the selected vendor
        String sql = "{ call := PS_DISA_POTXMN. get_supply_sector_emailId(?,?) }";
        poCallableStatement = connection.prepareCall(sql);
        // register the type of the out parameter - an Oracle specific type
        poCallableStatement.setInt(1, poNum);
        poCallableStatement.registerOutParameter(2, Types.VARCHAR);

        // execute and retrieve the result set
        poCallableStatement.execute();
        retString = poCallableStatement.getString(2);
    }
    catch (Exception ex) {
        JDBCHelper.rollback(connection);
        log.error(ex.getMessage(), ex);
        throw new SystemException(ex.getMessage(), ex);
    }

    return retString;
}

Oracle程序:

procedure get_supply_sector_emailId(p_PONUMBER IN number, p_emailId  OUT varchar2) is
begin

select tparcomm 
    into   p_emailId
      from   tra_parpostes, LIENSECAPPRO, SECAPPRO, CDEENTCDE
      where  tpartabl = 9612
      and    ecdcincde = p_PONUMBER
      and    tparpost = SAPCEXAP
      and    liacfin = ecdcfin
       AND    liaccin = ecdccin
      AND    liacinap = sapcinap
      AND    LIASITE=ECDSITE
      and    langue = 'US' 
      AND     tparcmag = 0
      and    tparcomm is not null;

exception
    when others then
    dbms_output.put_line('Excep:' || sqlerrm);
end;

由于我是从Java接口ORACLE db的新手,所以我们非常感谢您的帮助。

1 个答案:

答案 0 :(得分:4)

你确定需要“=”吗?当我们在IBatis SQL Maps中调用过程时,我们不使用它:

{ call PKG_GOYA_WEB.GOYAPES_ULTIMA_FECHA_LOGUEO(?,?,?) }