Results 1 to 2 of 2
  1. #1
    renu is offline Senior Member
    Join Date
    May 2010
    Rep Power

    Question how do i read a clob data from a function written in oracle in java code

    Hi ,

    I have a stored procedure written in oracle which returns a clob data .
    How can i get the clob data into the file in java.

    here is my code ....pls help me with any changes i have to do , so that it works.
    Thank You in Advance for all the kind help in time .

    Java Code:
    //		The extract table now contains data in it.
    		CallableStatement proc_stmt;		
    		try {
    			FileOutputStream fos;	
    			fos = new FileOutputStream(new File(OutputFile),false);
    			Writer out = new OutputStreamWriter(new BufferedOutputStream(fos));		
    			proc_stmt = connection.prepareCall("{? = call PKG_EXTRACTION_DATA.F_CREATE_HEADER(?)}");	
    //			Register the type of the return value		
    //			proc_stmt.registerOutParameter(1,OracleTypes.CLOB);	
    //			Execute and retrieve the returned value
    //			String  retValue = proc_stmt.getString(1);
    			Clob  retValue = proc_stmt.getClob(1);
    //			out.write(retValue.toString());
    			//get the character stream of our CLOB data
    			Reader reader = retValue.getCharacterStream();
    			char[] buffer = new char[1];
    			while( > 0) {
    //			out.write(retValue);

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power


    Does that work?
    If not then what problems are you encountering?

Similar Threads

  1. I need some java / html code written
    By DeDanan in forum New To Java
    Replies: 2
    Last Post: 03-01-2011, 09:36 AM
  2. Replies: 7
    Last Post: 02-11-2011, 06:38 AM
  3. how read a data from a cheque scanner in java
    By prabhug1987 in forum Networking
    Replies: 0
    Last Post: 12-03-2010, 11:39 AM
  4. Replies: 2
    Last Post: 07-28-2010, 04:14 PM
  5. Oracle sqlldr in JAVA code
    By digioleg in forum JDBC
    Replies: 4
    Last Post: 08-25-2009, 08:31 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