简体   繁体   中英

I'm getting ORA-06550 when trying to call a stored Oracle procedure from Java code

Error Description:

 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 Code:

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:

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;

Since I'm a novice in Interfacing with ORACLE db from Java any help is appreciated.

Are you sure the "=" is needed? We don't use it when we call procedures in our IBatis SQL Maps:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM