Results 1 to 4 of 4
  1. #1
    parame is offline Member
    Join Date
    Aug 2012
    Posts
    1
    Rep Power
    0

    Default PL SQL Function From Java

    How to call PL SQL function INOUT Record Type parameters from java.

  2. #2
    Join Date
    Feb 2012
    Posts
    14
    Rep Power
    0

    Default Re: PL SQL Function From Java

    by using prepareCall method of CallableStatement.

    example:

    CallableStatement cst=connection.prepareCall("{? = call std_getInfoFunc}");
    cst.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR);
    cst.execute();
    Last edited by cnu.nandhikonda@gmail.com; 08-22-2012 at 08:08 AM.

  3. #3
    farrukh is offline Member
    Join Date
    Aug 2012
    Posts
    13
    Rep Power
    0

    Default Re: PL SQL Function From Java

    CallableStatement cstmt = connection.prepareCall("{call stored_procedure(?)}");
    cstmt.setInt(param_name, value);
    cstmt.executeUpdate();
    Integer i = cstmt.getInt(param_name);

    You can use parameter index as well instead of param name.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default Re: PL SQL Function From Java

    I ralise this is a week old, but if you're still hunting can you confirm you;re talking about a PLSQL record eg:
    Java Code:
       TYPE DeptRec IS RECORD ( 
          dept_id   dept.deptno%TYPE,
          dept_name VARCHAR2(14),
          dept_loc  VARCHAR2(13));
    because if so then you can't.
    JDBC uses SQL, and does not understand PL/SQL types (like records).
    You'll have to define them as SQL types.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Recursive function to iteractive function
    By mikeZet in forum New To Java
    Replies: 0
    Last Post: 03-13-2012, 01:42 AM
  2. php function to java
    By thorbcn in forum New To Java
    Replies: 2
    Last Post: 07-04-2011, 12:40 AM
  3. Calling function in Javascript- from other function
    By jdigger in forum New To Java
    Replies: 1
    Last Post: 02-27-2011, 09:00 PM
  4. Replies: 3
    Last Post: 12-04-2009, 03:08 PM
  5. help with function in java!!!!
    By ricky in forum New To Java
    Replies: 6
    Last Post: 10-12-2009, 01:24 PM

Posting Permissions

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