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 8173311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:06:08+00:00 2026-06-06T22:06:08+00:00

Hi I am using spring jdbctemplate to invoke an oracle function which takes an

  • 0

Hi I am using spring jdbctemplate to invoke an oracle function which takes an integer input.

Oracle function is :
    FUNCTION get_key_types (type_id IN integer)
  RETURN tcur_key_types_det
IS 
  lv_cur   tcur_key_types_det;
 BEGIN
  IF type_id IS NULL
  THEN
     RAISE KEY_ERROR;
  ELSE
     OPEN lv_cur FOR
          SELECT   key_criteria_cd,
                   key_type_name,
                   KEY_COLUMN_TXT,
                   data_type_cd
            FROM   key_criteria
           WHERE   criteria_type_id = type_id
        ORDER BY   key_type_name;
  END IF;
RETURN lv_cur;
END get_key_types;

I have a Java class that extends from Class StoredProcedure which passes and integer argument to invoke the oracle function as follows.

public class KeyTypeService extends StoredProcedure{
public KeyTypeService(DataSource dataSource,String sqlString) {
    setDataSource(dataSource);
    setFunction(true);
    setSql(sqlString);
    declareParameter(new SqlParameter("type_id",Types.INTEGER));
    declareParameter(new SqlOutParameter("functionName",OracleTypes.CURSOR,new KeyTypeMapper()));
    compile();
}

public Map execute(int category_id) {
    Map<String, Object> inputs = new HashMap<String, Object>();
    inputs.put("type_id", category_id);
    Map output = execute(inputs);
    return output;     
}

}

I invoke the oracle function as follows.

int i = 60;
KeyTypeService keyTypeService = new KeyTypeService((DataSource)c.getBean   ("DataSource"),"get_key_types"); 
map = keyTypeService.execute(i);

I get the following error indicating that I am not passing the correct data type expected.

PLS-00306: wrong number or types of arguments in call to ‘get_key_types’
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

Any help would be highly appreciated..

  • 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-06T22:06:09+00:00Added an answer on June 6, 2026 at 10:06 pm

    Since my comment was correct:

    The out parameter must come first.

    Spring documentation might not explicitly talk about the order but the parameter order must be the same order as when you would call a pl/sql function without spring. I.e.:

    out = call pacakge.function(in)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Spring JdbcTemplate/SimpleJdbcTemplate in combination with an Oracle datasource (oracle.jdbc.pool.OracleDataSource) via JNDI
I've a function updating a database table using Spring's JdbcTemplate and for some reason
I'm using Spring JdbcTemplate interface for fetching data from a MS SqlServer DB. In
Using Spring 2.5 tag library, I have an Integer value in a command form
I'm using Apache Derby with the Spring JdbcTemplate inside a web app running on
We use Spring's JdbcTemplate which is configured through Spring config as illustrated below. Is
Using Spring 1.2.1 and oracle.jdbc.pool.OracleDataSource 10.2.0.3.0 I sometimes get a stack trace like below.
I am using Spring and JDBCTemplate. The scenario is a CUSTOMER table and ORDERS
I am using JDBC (and spring-jdbc's jdbcTemplate) to access my database in a java
From the Spring JDBC documentation, I know how to insert a blob using JdbcTemplate

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.