Results 1 to 2 of 2
  1. #1
    anjibman is offline Member
    Join Date
    Dec 2010
    Posts
    52
    Rep Power
    0

    Default Getting return value from oracle function using SimpleJdbcCall

    I have Oracle function defined as:

    Java Code:
    function get_user_by_term (inUserTerm number) return number;
    Now I want to call this function using Spring SimpleJdbCCall but not sure how I can read return value since I don't have out param in function. I can't change the Oracle function code.

    Code I have so far in Java is:

    Java Code:
    SimpleJdbcCall simpleJdbcCall = new SimpleJdbcCall(dataSource)
            .withSchemaName("SCHMA").withCatalogName("PKG_USER")
            .withProcedureName("get_user_by_term");
    Map<String, Object> inParamMap = new HashMap<String, Object>();
    inParamMap.put("inUserTerm ", userTermId );
    SqlParameterSource in = new MapSqlParameterSource(inParamMap);
    simpleJdbcCall.execute(in);

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    27

    Default Re: Getting return value from oracle function using SimpleJdbcCall

    It's a function, so you should be using withFunction, not withProcedure.
    And also withReturn, to indicate that there is a return value that should be included.
    The execute method returns a map of stuff, one of which (there should only be one thing in it, to be honest) will be the return value.

    This is all in the API.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 7
    Last Post: 04-02-2014, 02:15 PM
  2. How to return a vector from a function
    By 8Observer8 in forum New To Java
    Replies: 6
    Last Post: 05-17-2013, 02:38 PM
  3. function return 1 > 0 ??
    By garnachito in forum Android
    Replies: 4
    Last Post: 02-19-2013, 10:26 AM
  4. Return ArrayList function - Java
    By skp123 in forum New To Java
    Replies: 23
    Last Post: 05-01-2011, 04:11 AM
  5. getSession() Function Return Null value
    By dalchndr@gmail.com in forum Advanced Java
    Replies: 0
    Last Post: 11-04-2009, 07:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •