Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8517549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:43:57+00:00 2026-06-11T05:43:57+00:00

Hi I am trying to execute stored procedures using Spring JDBC. Here’s the SP

  • 0

Hi I am trying to execute stored procedures using Spring JDBC.
Here’s the SP class

 class IncrementExtraBalanceStoredProcedure extends StoredProcedure {

    /**
     * @param jdbcTemplate
     * @param procedureName
     */
    public IncrementExtraBalanceStoredProcedure(JdbcTemplate jdbcTemplate, String procedureName) {
        super(jdbcTemplate, procedureName);
        declareParameter(new SqlOutParameter(O_RETURN_CODE, Types.INTEGER));
        declareParameter(new SqlParameter(P_NUMEC, Types.INTEGER));
        declareParameter(new SqlParameter(P_GBYTES, Types.INTEGER));
        compile();
    }

    /**
     * @param inputBean
     * @return resultObjects
     */
    public Map<String, Object> execute(RateLimitLogBean inputBean) {
        Map<String,Object> sqlMap = new HashMap<String,Object>();
        sqlMap.put(P_NUMEC, inputBean.getNumec());
        sqlMap.put(P_GBYTES,  inputBean.getGb());
        return super.execute(sqlMap);
    }

}

I am calling this class from this method.

 public int incrementExtraBalance(RateLimitLogBean inputBean) {
    IncrementExtraBalanceStoredProcedure procedure = new IncrementExtraBalanceStoredProcedure(this.jdbcTemplate, "RATELIMIT_OWN.increment_extra_balance");
    Map<String, Object> resultMap = procedure.execute(inputBean);
    if (!StringUtils.isEmpty(resultMap)) {
        return ((Integer) resultMap.get(O_RETURN_CODE)).intValue();
    }
    return -1;
}

But I am getting null value as O_RETURN_CODE. It’s supposed to return 0
The execution of this function from Toad – Oracle Db

var z number

exec RATELIMIT_OWN.unlimit_contract (0123,:z)

print z

I got 0 as output in Toad.

Why I am getting null value as return from Java code (no sql exceptions).
Is there anything wrong with code?

native calls returning proper output

public void unlimitContract(RateLimitLogBean inputBean, boolean load) throws SQLException {
    String sql = "{call RATELIMIT_OWN.unlimit_contract (?,?)}";
    CallableStatement callableStatement = this.dataSource.getConnection().prepareCall(sql);
    callableStatement.setInt(1, 0123);
    callableStatement.registerOutParameter(2, java.sql.Types.INTEGER);
     
    callableStatement.executeUpdate();
     
    int resultCode = callableStatement.getInt(2);
}

SQL SP

CREATE OR REPLACE PROCEDURE RATELIMIT_OWN.increment_extra_balance (p_numec IN  NUMBER,
  p_gbytes            IN    NUMBER,
  o_return_code    OUT NUMBER)
AS
   
   message            logs.errormsg%TYPE;
   
BEGIN

  update balance set extrabalance=extrabalance+(p_gbytes*1073741824),limited=0 WHERE numec = p_numec;
  
  IF SQL%ROWCOUNT = 0
  THEN
    o_return_code:=1;
  ELSE
    o_return_code:=0;
    message := 'Cops added ' || p_gbytes || ' gb extra volume';
    INSERT INTO logs (logid, eventid, origin, numec, VALUE, errormsg) VALUES (seq_log.NEXTVAL, 'NEXTRAROV', 'increment_extra_balance', p_numec, p_gbytes, message);
  END IF;

   commit;
  
  EXCEPTION
    WHEN OTHERS
    THEN
      o_return_code := SQLCODE;
      ROLLBACK;  
        
END;
/
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:43:59+00:00Added an answer on June 11, 2026 at 5:43 am

    The order of your parameters looks wrong. Try:

       declareParameter(new SqlParameter(P_NUMEC, Types.INTEGER));
       declareParameter(new SqlParameter(P_GBYTES, Types.INTEGER));
       declareParameter(new SqlOutParameter(O_RETURN_CODE, Types.INTEGER));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to execute a simple stored procedure with Spring/Hibernate using Annotations. Here are
I'm trying to get a recordset from a stored procedure using ADODB. Stored procedures
I am trying to execute a query using a stored procedure in Eclipse, but
I'm trying to execute a stored procedure using ODBC which has a parameter, but
trying to execute the stored proc in EF using the following code: var params
So, I'm trying to use ODBC to execute a stored procedure in an SQL
I am trying to execute an Oracle stored proc via an Entity Framework data
Trying to execute powershell script in my C# code. Using .NET Framework v. 4.0.30319
While trying to execute the following lines only the last two statements are displayed(Here
In my Script Component, am trying to execute Stored Procedure => which return multiple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.