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

  • Home
  • SEARCH
  • 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 8553959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:46:23+00:00 2026-06-11T14:46:23+00:00

I have a procedure in Oracle that has 12 total parameters and 3 optional.

  • 0

I have a procedure in Oracle that has 12 total parameters and 3 optional. How can I account for these optional parameters if I’m using the StoredProcedure object in Spring 3.1.0?

Here’s what I have so far in my StoredProcedure class

public Map<String, Object> execute(Evaluation evaluation) {
    Map<String, Object> input_params = new HashMap<String, Object>();
    input_params.put(COURSE_MAIN_PK1_INPUT_PARAM, evaluation.getCourseId());
    input_params.put(USERS_PK1_INPUT_PARAM, evaluation.getUsersPk1());
    input_params.put(ACCREDITATION_PK1_INPUT_PARAM, evaluation.getAccreditationPk1());
    input_params.put(TYPE_PK1_INPUT_PARAM, evaluation.getTypePk1());
    input_params.put(PRIVACY_TYPE_PK1_INPUT_PARAM, evaluation.getPrivacyTypePk1());
    input_params.put(FORM_TYPE_PK1_INPUT_PARAM, evaluation.getFormTypePk1());
    input_params.put(TITLE_INPUT_PARAM, evaluation.getTitle());
    input_params.put(DESCRIPTION_INPUT_PARAM, evaluation.getDescription());

    if(evaluation.getStartDate() != null) {
        input_params.put(START_DATE_INPUT_PARAM, new java.sql.Date(evaluation.getStartDate().getMillis()));         
    }

    if(evaluation.getEndDate() != null) {
        input_params.put(END_DATE_INPUT_PARAM, new java.sql.Date(evaluation.getEndDate().getMillis())); 
    }

    input_params.put(SAVE_TO_GRADECENTER_INPUT_PARAM, evaluation.getGradeCenterColumn());
    input_params.put(CREATE_ANNOUNCEMENT_INPUT_PARAM, evaluation.getAnnouncement());

    return super.execute(input_params);
}

The problem with this is that I’m supplying 12 parameters and if the start and end dates are null, now I’m supplying 10 and getting an exception.

The default values for the dates in the database is null.

  • 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-11T14:46:24+00:00Added an answer on June 11, 2026 at 2:46 pm

    JDBC’s PreparedStatement provides a facility to set null values to parameters using the setNull method. So, as long as you pass all the parameters to the stored procedure if they are null, Spring would be able to prepare the statement and execute it.

    So, you needed to add the input parameters whose values are null, to the Map that is sent to the stored procedure call.

    input_params.put(START_DATE_INPUT_PARAM, 
                     (null != evaluation.getStartDate() 
                      ? new java.sql.Date(evaluation.getStartDate().getMillis()) 
                      : null));
    

    The same would apply to END_DATE_INPUT_PARAM as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Oracle trigger which is calling a stored procedure that has PRAGMA
I have a situation where I have an Oracle procedure that is being called
I have the following iBatis mapping for an Oracle Stored Procedure that returns a
I have a stored procedure in oracle which is using cursor.Its fetching the data
I am using Oracle 10g and I have the following stored procedure: CREATE OR
So if a language provides higher order procedure then I can have procedure that
Background - I have a client that has an Oracle database with many procedures
We are using Spring SimpleJdbcCall to call stored procedures in Oracle that return cursors.
I'm trying to call an Oracle stored procedure that accepts no input parameters. However,
I have a stored procedure made in Oracle 9g that returns a cursor with

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.