【问题标题】:I'm getting ORA-06550 when trying to call a stored Oracle procedure from Java code尝试从 Java 代码调用存储的 Oracle 过程时出现 ORA-06550
【发布时间】:2012-02-20 23:08:48
【问题描述】:

错误说明:

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 交互的新手,因此不胜感激。

【问题讨论】:

    标签: java oracle


    【解决方案1】:

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

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

    【讨论】:

    • 这绝对是正确的答案。使用 CALL 调用存储过程时,没有分配。这是语法ss64.com/ora/call.html
    猜你喜欢
    • 2011-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-25
    • 2015-12-12
    • 2018-06-12
    • 2013-12-02
    相关资源
    最近更新 更多