CLOB Data Read

Hi,
We have a table in our oracle database having CLOB datatype as column.This column gets populated from Java application wherein the application reads an excel file from front end into CLOB column.
My requirement is to read this CLOB column from database and insert data into some file(CSV Format). say if excel was read into CLOB with 3 column and 10 rows, then I should also be able to read this column and insert into some file(CSV Format) that has same structure as of excel file.
For this i call the JavaConcurrentProgram.
Can anyone tell me what will i do for this? Any help would be appreciated.
Thanks in advance

Hi chandra,
Thanks for ur reply.
I create the EO and VO for file uploading.
I want to upload the file into data base when i clicked on the submit button.So i write the row creation code in PFR.
Actually my requirement is: whenever we upload the file into database(CLOB cloumn) by using the javaconcurrentprogram we convert the clob data content is stroed in .dat file certain path.
for this i write the code like this:
Actuall class+:*
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getApplicationModule(webBean);
if (pageContext.getParameter("go") != null)
{ processFileUpload(pageContext, webBean, am);
protected void processFileUpload(OAPageContext pageContext, OAWebBean webBean, OAApplicationModule am)
// Get hold of the binary fle contents
DataObject fleUploadData = (DataObject)pageContext.getNamedDataObject("fileupload");
if (fleUploadData == null) return;
String fleName = (String)fleUploadData.selectValue(null,"UPLOAD_FILE_NAME");
if (fleName == null) return;
String contentType =(String)fleUploadData.selectValue(null,"UPLOAD_FILE_MIME_TYPE");
BlobDomain uploadedByteStream = (BlobDomain)fleUploadData.selectValue(null,fleName);
if (uploadedByteStream == null) return;
// convert binary fle contents into an ASCII stream
System.out.println("after calling if block");
try {
String inputStream = streamToString(contentType, uploadedByteStream.getInputStream() );
String purposeCode = null;
System.out.println("after calling if block");
System.out.println("store the values in table");
// Store ASCII in the fle in the database
primaryKey = storeStream(inputStream , purposeCode, am);
System.out.println("after calling if block");
System.out.println("the orgid value iss "+(am.getOADBTransaction()).getOrgId());
int orgId = ((OADBTransactionImpl)am.getOADBTransaction()).getOrgId();
// submit the printing request
submitConcurrentProgram(primaryKey, purposeCode, orgId, am.getOADBTransaction().getJdbcConnection());
} catch (IOException ex) {
throw OAException.wrapperException(ex);
} catch (SQLException ex) {
throw OAException.wrapperException(ex);
} catch (RequestSubmissionException ex) {
throw OAException.wrapperException(ex);
protected String streamToString(String mimeType, InputStream inputStream) throws IOException
String result;
System.out.println("mime type is "+mimeType);
// check if this is an Excel spreadsheet
if ("application/vnd.ms-excel".equalsIgnoreCase(mimeType))
try {
result = xlsToString(inputStream);
} catch (jxl.read.biff.BiffException ex)
{ // if not, then assume this is an ASCII stream
System.out.println("catch blockk");
inputStream.reset();
result = inputStream.toString();//streamToString(mimeType,inputStream); ////streamToString("ASCII",inputStream);
} else
{ // otherwise an ASCII stream
result =inputStream.toString();//streamToString(mimeType,inputStream); ////streamToString("ASCII",inputStream);
return result;
private final static String CSV_SEPARATOR = ",";
private String xlsToString(InputStream stream)
throws jxl.read.biff.BiffException
StringWriter stringWriter = new StringWriter();
BufferedWriter bufferedWriter = new BufferedWriter(stringWriter);
try {
WorkbookSettings ws = new WorkbookSettings();
ws.setLocale(new Locale("en", "EN"));
Workbook w = Workbook.getWorkbook(stream, ws);
// Gets the sheets from workbook
for (int sheet = 0; sheet < w.getNumberOfSheets(); sheet++)
Sheet s = w.getSheet(sheet);
Cell[] row = null;
// Gets the cells from sheet
for (int i = 0 ; i < s.getRows() ; i++)
row = s.getRow(i);
if (row.length > 0)
bufferedWriter.write(formatExcelCell(row[0]));
for (int j = 1; j < row.length; j++)
bufferedWriter.write(CSV_SEPARATOR);
bufferedWriter.write(formatExcelCell(row[j]));
bufferedWriter.newLine();
bufferedWriter.flush();
catch(jxl.read.biff.BiffException ex)
throw ex;
catch (Exception ex)
throw OAException.wrapperException(ex);
return stringWriter.toString();
private final static String QUOTE_STRING ="\"";
private String formatExcelCell(Cell cell)
SimpleDateFormat dateFormatter = new SimpleDateFormat("d-MMM-yyyy");
if (cell == null) return null;
String rowCell = cell.getContents();
// format the date
if ( cell.getType().equals(cell.getType().DATE) )
rowCell = dateFormatter.format(((DateCell)cell).getDate());
// double each quote
String result = rowCell.replaceAll(QUOTE_STRING, QUOTE_STRING+QUOTE_STRING);
// surround with quotes if comma or quote is present
if (result.indexOf(CSV_SEPARATOR) >0 || result.indexOf(QUOTE_STRING) >0)
result = QUOTE_STRING + result + QUOTE_STRING;
return result;
protected Number generatePrimaryKey(OAApplicationModule am)
OAViewObject viewObject = (OAViewObject)am.findViewObject("FileUploadKeyVO1");
viewObject.setMaxFetchSize(1);
viewObject.executeQuery();
return (Number) (viewObject.first().getAttribute("Id"));
*public Number storeStream*(String inputStream, String purposeCode,OAApplicationModule am)
OAViewObject viewObject = (OAViewObject)am.findViewObject("xxcrmFileUploadVO1");
viewObject.setMaxFetchSize(0);
ClobDomain myClob = new ClobDomain();
myClob.setChars(inputStream.toCharArray());
OARow row = (OARow)viewObject.createRow();
row.setAttribute("FileContents",myClob);
primaryKey = generatePrimaryKey(am);
row.setAttribute("PurposeCode", purposeCode);
row.setAttribute("FileId", primaryKey);
viewObject.insertRow(row);
am.getTransaction().commit();
return primaryKey;
public void runProgram(CpContext cpcontext) {
try {
// read parameters
// execute business logic
cpcontext.getReqCompletion().setCompletion(ReqCompletion.NORMAL, "Request Completed Normal");
} catch (Exception ex) {
// report exception
cpcontext.getReqCompletion().setCompletion(ReqCompletion.ERROR, "Error building output fle");
} finally {
cpcontext.releaseJDBCConnection();
static public Map convertParameters(ParameterList parameterList)
{ Map result = new HashMap();
while( parameterList.hasMoreElements() ) {
NameValueType nameValueType = parameterList.nextParameter();
if (nameValueType.getValue() != null)
result.put(nameValueType.getName(), nameValueType.getValue());
return result;
protected void submitConcurrentProgram(Number primaryKey, String purposeCode, int orgId,
Connection connection) throws IOException, SQLException, RequestSubmissionException
System.out.println("before getting the output");
System.out.println("after getting the output");
ConcurrentRequest request = new ConcurrentRequest(connection);
Vector param = new Vector();
param.add(primaryKey.stringValue());
param.add(purposeCode);
param.add(String.valueOf(orgId));
int reqId = request.submitRequest("XXNC", "XXNC_FILEWRITE_JAVA", "Print CLOB",null, false, param);
connection.commit();
MessageToken[] tokens = { new MessageToken("REQUEST", String.valueOf(reqId)) };
OAException confrmMessage = new OAException("XXNC",
"XXNC_TEST_MSG",
tokens,
OAException.CONFIRMATION,
null);
throw confrmMessage;
_+*JavaconcurrentProgram class:*+_
/* for getting the clob data content stored into certain path*/
public String getOutput(Connection connection,
BigDecimal primaryKey) throws SQLException,
IOException
String statement =
"select file_contents from xxcrm_file_upload where file_id = :1";
String result;
PreparedStatement stmt = null;
ResultSet resultSet = null;
try
stmt = connection.prepareStatement(statement);
stmt.setBigDecimal(1, primaryKey);
resultSet = stmt.executeQuery();
resultSet.next();
result = //streamToString("application/vnd.ms-excel",resultSet.getAsciiStream(1));
resultSet.getAsciiStream(1).toString(); //streamToString("ASCII",resultSet.getAsciiStream(1) );
File data = new File("/u01/VIS/apps/apps_st/appl/xxnc/12.0.0/bin/TestClob.dat");
Reader reader = resultSet.getCharacterStream(1);
FileWriter writer = new FileWriter(data);
char[] buffer = new char[1];
while (reader.read(buffer) > 0) {
writer.write(buffer);
writer.close();
resultSet.close();
resultSet = null;
stmt.close();
stmt = null;
} finally
if (resultSet != null)
try
resultSet.close();
} catch (SQLException ex)
if (stmt != null)
try
stmt.close();
} catch (SQLException ex)
try
connection.commit();
} catch (SQLException ex)
return result;
public void runProgram(CpContext cpcontext)
Number primarykey = 0;
String s = cpcontext.getProfileStore().getProfile("APPS_FRAMEWORK_AGENT");
if (!s.endsWith("/"))
s = (new StringBuilder()).append(s).append("/").toString();
s = (new StringBuilder()).append(s).append("OA_MEDIA").toString();
Connection con = cpcontext.getJDBCConnection();
ReqCompletion lRC = cpcontext.getReqCompletion();
try
// Connection con = DriverManager.getConnection("jdbc:oracle:thin:@erpdb.nalsoft.net:1521:VIS","apps","visdb_234");
PreparedStatement st =
con.prepareStatement("select file_id from xxcrm_file_upload order by file_id desc");
ResultSet rs = st.executeQuery();
OutFile lOF = cpcontext.getOutFile();
LogFile lLF = cpcontext.getLogFile();
if (rs.next())
primarykey = rs.getBigDecimal(1);
BigDecimal primarybig = new BigDecimal(primarykey.toString());
s = getOutput(con, primarybig);
lOF.write(s);
lRC.setCompletion(ReqCompletion.NORMAL, "Request Completed Normal");
} catch (Exception e)
{ //Catch exception if any
System.err.println("Error: " + e.getMessage());
lRC.setCompletion(ReqCompletion.ERROR, e.toString());
} finally
cpcontext.releaseJDBCConnection();
Please give me the suggestion.

Similar Messages

  • Can we read clob data present in oracle database by BPEL

    Hi all,
    Please let me know or help me understand whether we can read clob data(excel file) present in database by BPEL?
    TIA

    Try this one,
    Re: Reading Xml file from clob column in the staging table
    Hope it helps,

  • Reading CLOB data using jdbc thin driver

    Hi,
    When I try reading data for a CLOB column using thin jdbc driver, I get the following error message
    "Exception: ORA-06550: line 1, column 22:
    PLS-00302: component 'GETCHUNKSIZE' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored".
    This error message is displayed when the call is made to get the character stream from the Clob object.
    Do I need to any server side setup before I can access CLOB data from the database?
    thanks.
    Puru Balakrishnan

    I updated to the latest jdbc drivers, 816classes12b.zip, and the problem went away.
    null

  • How to read zipped CLOB data in SQL developer

    hi,
    We have recently switched to SQL developer from TOAD,
    And i have few tables with CLOB column types , and having data in it in zipped form
    Functionality to view zipped CLOB data is there in Toad, please suggest how can i use same in SQL dev.
    Thanks,
    Mayank
    Lead DBA
    Budapest

    Hi,
    I downloaded the SQL Server 2000 Driver for JDBC Service Pack 1 at http://www.microsoft.com/downloads/details.aspx?familyid=4f8f2f01-1ed7-4c4d-8f7b-3d47969e66ae&displaylang=en#filelist.
    I put the mysql jdbc driver to tomcat before.
    However, I write an application program running on console window.
    Where should I put that msbase.jar, mssqlserver.jar and msutil.jar on the windows 2000 server?
    Also, how can I make the application program as a service running on windows 2000 server?
    Thanks for help

  • Can not Load CLOB data 32k to target table

    SQL> DESC testmon1 ;
    Name Null? Type
    FILENAME VARCHAR2(200)
    SCANSTARTTIME VARCHAR2(50)
    SCANENDTIME VARCHAR2(50)
    JOBID VARCHAR2(50)
    SCANNAME VARCHAR2(200)
    SCANTYPE VARCHAR2(200)
    FAULTLINEID VARCHAR2(50)
    RISK VARCHAR2(5)
    VULNNAME VARCHAR2(2000)
    CVE VARCHAR2(200)
    DESCRIPTION CLOB
    OBSERVATION CLOB
    RECOMMENDATION CLOB
    SQL> DESC test_target;
    Name Null? Type
    LOCALID NOT NULL NUMBER
    DESCRIPTION NOT NULL CLOB
    SCANTYPE NOT NULL VARCHAR2(12)
    RISK NOT NULL VARCHAR2(6)
    TIMESTAMP NOT NULL DATE
    VULNERABILITY_NAME NOT NULL VARCHAR2(2000)
    CVE_ID VARCHAR2(200)
    BUGTRAQ_ID VARCHAR2(200)
    ORIGINAL VARCHAR2(50)
    RECOMMEND CLOB
    VERSION VARCHAR2(15)
    FAMILY VARCHAR2(15)
    XREF VARCHAR2(15)
    create or replace PROCEDURE proc1 AS
    CURSOR C1 IS
    SELECT FAULTLINEID,VULNNAME,scanstarttime, risk,
    dbms_lob.substr(DESCRIPTION,dbms_lob.getlength(DESCRIPTION),1) "DESCR",dbms_lob.substr(OBSERVATION,dbms_lob.getlength(OBSERVATION),1) "OBS",
    dbms_lob.substr(RECOMMENDATION) "REC",CVE
    FROM testmon1;
    c_rec C1%ROWTYPE;
    descobs clob;
    FSCAN_VULN_TRANS_REC VULN_TRANSFORM_STG%ROWTYPE;
    TIMESTAMP varchar2(50);
    riskval varchar2(10);
    pCTX PLOG.LOG_CTX := PLOG.init (pSECTION => 'foundscanVuln Procedure',
    pLEVEL => PLOG.LDEBUG,
    pLOG4J => TRUE,
    pLOGTABLE => TRUE,
    pOUT_TRANS => TRUE,
    pALERT => TRUE,
    pTRACE => TRUE,
    pDBMS_OUTPUT => TRUE);
    amount number;
    buffer varchar2(32000);
    BEGIN
    ---INITIALIZE THE LOCATOR FOR CLOB DATA TYPE
    select observation into descobs from testmon1 where rownum=1;
    OPEN C1;
    loop
    fetch C1 INTO c_rec;
    exit when C1%NOTFOUND;
    --LOAD THE DESCRIPTION FIELD FROM CURSOR AND WRITE IT TO THE CLOB LOCATOR descobs.
    dbms_lob.Write(descobs,dbms_lob(c_rec.DESCR),1,c_rec.DESCR);
    ------APPEND THE OBSERVATION FIELD FROM CURSOR TO THE CLOB LOCATOR descobs.
    dbms_lob.Writeappend(descobs,dbms_lob(c_rec.DESCR),c_rec.OBS);
    -- dbms_output.put_line ('the timestamp is :'||c_rec.scanstarttime);
    --dbms_lob.write(descobs,amount,1,buffer);
    descobs:=c_rec.OBS;
    --dbms_lob.read(descobs,amount,1,buffer);
    --dbms_lob.append(c_rec.DESCR,c_rec.OBS);
    --descobs:=c_rec.OBS;
    --dbms_output.put_line ('the ADDED DESCROBS is :'||dbms_lob.substr(c_rec.DESCR,dbms_lob.getlength(c_rec.DESCR),1));
    dbms_output.put_line ('the ADDED DESCRIPTION AND OBSERVATION is :'||descobs);
    --dbms_output.put_line ('the DESCROBS buffer  is :'||buffer);
    SELECT DESCRIPTION INTO FSCAN_VULN_TRANS_REC.DESCRIPTION
    FROM TESTMON1 WHERE ROWNUM=1;
    ---------LOAD THE DESCRIPTION+ observation value into the target table description
    DBMS_LOB.WRITE(FSCAN_VULN_TRANS_REC.DESCRIPTION, dbms_lob.getlength(descobs),1,descobs);
    TIMESTAMP:=substr(c_rec.scanstarttime,1,10)||' '|| substr(c_rec.scanstarttime,12,8);
    IF c_rec.risk <3
    THEN riskval:='Low';
    ELSIF c_rec.risk <6
    THEN riskval:='Medium';
    ELSIF c_rec.risk <10
    THEN riskval:='High';
    END IF;
    FSCAN_VULN_TRANS_REC.TIMESTAMP:=TO_DATE(TIMESTAMP, 'YYYY/MM/DD HH24:MI:SS');
    FSCAN_VULN_TRANS_REC.risk:= riskval;
    --dbms_lob.append(c_rec.DESCR,c_rec.OBS);
    FSCAN_VULN_TRANS_REC.DESCRIPTION:=c_rec.DESCR;
    FSCAN_VULN_TRANS_REC.RECOMMEND:=c_rec.REC;
    FSCAN_VULN_TRANS_REC.LocalID:=to_number(c_rec.FAULTLINEID);
    FSCAN_VULN_TRANS_REC.SCANTYPE:='FOUNDSCAN';
    FSCAN_VULN_TRANS_REC.CVE_ID:=c_rec.CVE;
    FSCAN_VULN_TRANS_REC.VULNERABILITY_NAME:=c_rec.VULNNAME;
    -- dbms_output.put_line ('the plog timestamp is :'||timestamp);
    -- dbms_output.put_line ('the timestamp is :'||riskval);
    --dbms_output.put_line ('the recommend is :'||FSCAN_VULN_TRANS_REC.RECOMMEND);
    --dbms_output.put_line ('the app desc is :'||FSCAN_VULN_TRANS_REC.DESCRIPTION);
    insert into test_target values FSCAN_VULN_TRANS_REC;
    End loop;
    close C1;
    commit;
    EXCEPTION
    WHEN OTHERS THEN
    -- dbms_output.put_line ('Data not found');
    -----------dbms_output.put_line (sqlcode|| ':'||sqlerrm);
    end proc1;
    using dbms_lob package is not helping. Either DB stops responding. Or the Observation field ( which has max length >300000) can not be loaed into a CLOB variable.
    Please help or give me a sample code that helps.

    select     
         BANKING_INSTITUTION.BANK_REF_CODE     C1_BANK_ID,
         BANKING_INSTITUTION.NAME_BANK     C2_BANK_NAME,
         BANKING_INSTITUTION.BANK_NUMBER     C3_BANK_NUMBER,
         BANKING_INSTITUTION.ISO_CODE     C4_GBA_CODE,
         BANKING_INSTITUTION.STATUS     C5_STATUS,
         BANKING_INSTITUTION.SOURCE     C6_SOURCE,
         BANKING_INSTITUTION.START_DATE_BANK     C7_START_DATE,
         BANKING_INSTITUTION.ADDRESS_BANK     C8_BANK_ADDRESS1
    from     REF_DATA_DB.BANKING_INSTITUTION BANKING_INSTITUTION
    where     (1=1)
    insert /*+ append */ into XXSVB.C$_0XXSVB_BANKS_STAGING
         C1_BANK_ID,
         C2_BANK_NAME,
         C3_BANK_NUMBER,
         C4_GBA_CODE,
         C5_STATUS,
         C6_SOURCE,
         C7_START_DATE,
         C8_BANK_ADDRESS1
    values
         :C1_BANK_ID,
         :C2_BANK_NAME,
         :C3_BANK_NUMBER,
         :C4_GBA_CODE,
         :C5_STATUS,
         :C6_SOURCE,
         :C7_START_DATE,
         :C8_BANK_ADDRESS1
    )

  • BLOB and CLOB data in BI Publisher

    Hello,
    I have an XML file with blob and clob data in it. I am using BI desktop publisher to load the xml file and create the rtf template. I am getting the following error:
    ConfFile: C:\Program Files\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\config\xdoconfig.xml
    Font Dir: C:\Program Files\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\fonts
    Run XDO Start
    Template: C:\work\employee.rtf
    RTFProcessor setLocale: en-us
    FOProcessor setData: C:\work\employee.xml
    FOProcessor setLocale: en-us
    Do i need to install anything or am i missing any configuration to read the blob and clob? Please advise
    thanks

    Check this out, hopefully it'll help you
    http://oraclebizint.wordpress.com/2007/11/12/oracle-bi-ee-101332-working-with-clob-fields/
    Fiston

  • The ADO NET Source was unable to process the data. ORA-64203: Destination buffer too small to hold CLOB data after character set conversion.

     We developed a SSIS Package to pull the data From Oracle source to Sql Server 2012. Here we used ADO.Net source to pull the records from Source but getting the below error after pulling some 40K records.
      [ADO NET Source [2]] Error: The ADO NET Source was unable to process the data. ORA-64203: Destination buffer too small to hold CLOB data after character set conversion.
    [SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. 
     The PrimeOutput method on ADO NET Source returned error code 0xC02090F5. 
     The component returned a failure code when the pipeline engine called PrimeOutput(). 
    The meaning of the failure code is defined by the component, 
    but the error is fatal and the pipeline stopped executing. 
     There may be error messages posted before this with more 
    information about the failure.
    Anything that we can do to fix this?

    Hi,
      Tried both....
      * Having schema type as Nvarchar(max). - Getting the same error.
      * Instead of ADO.Net Source used OLEDB Source with driver as " Oracle Provide for OLE DB" Getting error as below.
           [OLE DB Source [478]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.
           [SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  The PrimeOutput method on OLE DB Source returned error code 0xC0202009.  The component returned a failure
    code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.  There may be error messages posted before this with more information about the
    failure.
    Additional Info:
       * Here the Source task is getting failed not the conversion or destination task.
    Thanks,
    Loganathan A.

  • Problem in using CLOB Data from a Data and exporting into File

    Hi,
    UTL_FILE Error Occured while using UTL_FILE with CLOB Data.
    UTL_FILE: A write error occurred.
    The Below Code is for reference:
    DECLARE
    C_AMOUNT CONSTANT BINARY_INTEGER := 32767;
    L_BUFFER VARCHAR2(32767);
    L_CHR10 PLS_INTEGER;
    L_CLOBLEN PLS_INTEGER;
    L_FHANDLER UTL_FILE.FILE_TYPE;
    L_POS PLS_INTEGER := 1;
    BEGIN
         FILE_NAME:=UTL_FILE.FOPEN('EXPORT_DIR','EXPORT_FILE'||'.sql','W');
         FOR C1_EXP IN (SELECT INSERT_STRING FROM EXPORTED_DUMP) LOOP
         L_CLOBLEN := DBMS_LOB.GETLENGTH(C1_EXP.INSERT_STRING);
         DBMS_OUTPUT.PUT_LINE('THE CLOB LEN '||L_CLOBLEN);
         DBMS_OUTPUT.PUT_LINE('THE POSITION '||L_POS);
         WHILE L_POS < L_CLOBLEN LOOP
    L_BUFFER := DBMS_LOB.SUBSTR(C1_EXP.INSERT_STRING, C_AMOUNT, L_POS);
         DBMS_OUTPUT.PUT_LINE('THE BUFFER IS '||L_BUFFER);
    EXIT WHEN L_BUFFER IS NULL;
    UTL_FILE.PUT_LINE(FILE_NAME, C1_EXP.INSERT_STRING);
    L_POS := L_POS + LEAST(LENGTH(L_BUFFER)+1,c_amount);
    END LOOP;
         END LOOP;
    UTL_FILE.FCLOSE(FILE_NAME);
    EXCEPTION
    WHEN UTL_FILE.INTERNAL_ERROR THEN
    DBMS_OUTPUT.PUT_LINE ('UTL_FILE: An internal error occurred.');
    UTL_FILE.FCLOSE_ALL;
    WHEN UTL_FILE.INVALID_FILEHANDLE THEN
    DBMS_OUTPUT.PUT_LINE ('UTL_FILE: The file handle was invalid.');
    UTL_FILE.FCLOSE_ALL;
    WHEN UTL_FILE.INVALID_MODE THEN
    DBMS_OUTPUT.PUT_LINE ('UTL_FILE: An invalid open mode was given.');
    UTL_FILE.FCLOSE_ALL;
    WHEN UTL_FILE.INVALID_OPERATION THEN
    DBMS_OUTPUT.PUT_LINE ('UTL_FILE: An invalid operation was attempted.');
    UTL_FILE.FCLOSE_ALL;
    WHEN UTL_FILE.INVALID_PATH THEN
    DBMS_OUTPUT.PUT_LINE ('UTL_FILE: An invalid path was give for the file.');
    UTL_FILE.FCLOSE_ALL;
    WHEN UTL_FILE.READ_ERROR THEN
    DBMS_OUTPUT.PUT_LINE ('UTL_FILE: A read error occurred.');
    UTL_FILE.FCLOSE_ALL;
    WHEN UTL_FILE.WRITE_ERROR THEN
    DBMS_OUTPUT.PUT_LINE ('UTL_FILE: A write error occurred.');
    UTL_FILE.FCLOSE_ALL;
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE ('Some other error occurred.');
    UTL_FILE.FCLOSE_ALL;
    END;

    Hi user598986!
    OK, I understood that there is a problem with your code. But please would you be so kindly to tell us here what error exactly happens (the errormessage). Mabay after that someone will be able to help you.
    yours sincerely
    Florian W.
    P.S. If you enclose your code into tags it will be shown formated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Unload CLOB data to a flat file

    Hi,
    does anybody knows how to unload CLOB data to a flat file. Can u pl give a example. Is there any ulity in Oracle to unload data to a flat file. Whether we have to use the concatation operator for unloading the data to a flat file.
    help??????
    regards,
    gopu

    I don't know if there's an easy way, but you might want to try using the packages UTL_FILE and DBMS_LOB.
    Hope that helps.

  • Exporting Text data from PHP to Oracle CLOB data (Carriage return - issue)

    This is my original text content in PHP - Data type - Longtext
    SECTION - 1
    This a test description.This a test description.
    This a test description.This a test description.
    This a test description. This a test description.I exported the above content from PHP as a SQL script file (insert into.. ) - export.sql [ insert into table_name (id, text_content) values (1, '') ]
    while exporting data from PHP table into export file.. it replaced the "Carriage return" with "\r\n\r\n" in the insert statement for text_content column
    When I run this INSERT statement in Oracle (for longtext, I have created a CLOB column in Oracle), the following text_content data is inserted into CLOB column in Oracle.
    SECTION - 2
    This a test description.This a test description.\r\n\r\nThis a test description.This a
    test description.\r\n\r\nThis a test description.This a test description.Now I have created a item named P1_TEXT_CONTENT of type TEXTAREA and try to fetch the CLOB data into this page item.
    BUT textarea displays the entire content including "\r\n\r\n" as mentioned in SECTION - 2
    I want to display the content in textarea (item - P1_TEXT_CONTENT) without "\r\n\r\n" same as the original content with "Carriage return" as mentioned in SECTION - 1
    What are the options we have?
    Thanks,
    Deepak

    DeepakJ wrote:
    I want to display the content in textarea (item - P1_TEXT_CONTENT) without "\r\n\r\n" same as the original content with "Carriage return" as mentioned in SECTION - 1
    What are the options we have?Run an update on the Oracle table following the inserts to replace the escaped CR/LFs with real ones:
    update foo
    set clob_column = replace(clob_column, '\r\n', chr(13) || chr(10));You might want to experiment to see which characters are actually necessary. As an OS X/Linux user I'd probably just use a single LF chr(10).

  • Problem in spooling the clob data to Excel sheet

    Hi dev's
    currently i am using below version :
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production          
    PL/SQL Release 11.2.0.1.0 - Production                                          
    CORE     11.2.0.1.0     Production                                                        
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production                         
    NLSRTL Version 11.2.0.1.0 - Production                                      here is my DDL ststements :
    CREATE TABLE tt1 (n1 number,c1 varchar2(1),b1 clob);I inserted one record in tt1 table like :
    INSERT INTO tt1 values (1,'a',aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);length of clob data in b1 column is
    SELECT DBMS_LOB.GETLENGTH(b1) FROM tt1 WHERE n1 =1;
           1432
    1 rows selected What's my problem is :
    i am correctly spooling the data into .xls file But
    The Clob data is placed into sperate lines(cells). I need the CLOB (b1 column data) data INTO single ROW (cell)
    i am able to get the n1,c1 data into seperate cells.
    below is the excel sheet data (the space between rows are seperate lines):
    number_value     character_value     clob_value     
    1     a     gaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa     
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa               
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa               
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa               
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa               
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa               
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa               
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa               
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa               
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa               Please help me on this issue.
    Thanks,

    You may need to put double quotes around your CSV string data, so that Excel can recognise it as single values rather than trying to split it across cells/rows.
    For example a nicely formed CSV may look like:
    empno,ename,job,mgr,hiredate,sal,comm,deptno
    7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20
    7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30
    7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30
    7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20
    7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30
    7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30
    7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10
    7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20
    7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10
    7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30
    7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20
    7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30
    7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20
    7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10where the string data has double quotes around it. This also means that comma values within the quotes will not be treated as a new value, but rather as part of the text itself.

  • Error while loading data into clob data type.

    Hi,
    I have created interface to load data from oracle table into oracle table.In target table we have attribute with clob data type. while loading data into clob field ODI gave below error. I use odi 10.1.3.6.0
    java.lang.NumberFormatException: For input string: "4294967295"
         at java.lang.NumberFormatException.forInputString(Unknown Source)
         at java.lang.Integer.parseInt(Unknown Source)
         at java.lang.Integer.parseInt(Unknown Source)
    Let me know if anyone come across and resolved this kind of issue.
    Thanks much,
    Nishit Gajjar

    Mr. Gajjar,
    You didnt mention what KMs you are using ?
    have a read of
    Re: Facing issues while using BLOB
    and
    Load BLOB column in Oracle to Image column in MS SQL Server
    Try again.
    And can you please mark the Correct/Helpful points to the answers too.
    Edited by: actdi on Jan 10, 2012 10:45 AM

  • Using CLOB data type - Pros and Cons

    Dear Gurus,
    We are designing a database that will be receiving comments from external data source. These comments are stored as CLOB in the external database. We found that only 1% of incoming data will be larger than 4000 characters and are now evaluating the Pros and Cons of storing only 4000 characters of incoming comments in VARCHAR2 data type or using CLOB data type.
    Some of the concerns brought up during discussion were:
    - having to store CLOBs in separate tablespace;
    - applications, such Toad require changing defaults settings to display CLOBs in the grid. Default value is not to display them;
    - applications that build web page with CLOBs will be struggling to fit 18 thousand chararcters of which 17 thousand are blank lines;
    - cashing CLOBs in memory will consume big chunk of data buffers which will affect performance;
    - to manipulate CLOBs you need PL/SQL anonymous block or procedure;
    - bind variables cannot be assigned CLOB value;
    - dynamic SQL cannot use CLOBs;
    - temp tables don't work very well with CLOBs;
    - fuzzy logic search on CLOBs is ineffective;
    - not all ODBC drivers support Oracle CLOBs
    - UNION, MINUS, INTERSECT don't work with CLOBs
    I have not delt with CLOB data type in the past, so I am hoping to hear from you of any possible issues/hastles we may encounter?

    848428 wrote:
    Dear Gurus,
    We are designing a database that will be receiving comments from external data source. These comments are stored as CLOB in the external database. We found that only 1% of incoming data will be larger than 4000 characters and are now evaluating the Pros and Cons of storing only 4000 characters of incoming comments in VARCHAR2 data type or using CLOB data type.
    Some of the concerns brought up during discussion were:
    - having to store CLOBs in separate tablespace;They can be stored inline too. Depends on requirements.
    - applications, such Toad require changing defaults settings to display CLOBs in the grid. Default value is not to display them;Toad is a developer tool so that shouldn't matter. What should matter is how you display the data to end users etc. but that will depend on the interface. Some can handle CLOBs and others not. Again, it depends on the requirements.
    - applications that build web page with CLOBs will be struggling to fit 18 thousand chararcters of which 17 thousand are blank lines;Why would they struggle? 18,000 characters is only around 18k in file size, that's not that big to a web page.
    - cashing CLOBs in memory will consume big chunk of data buffers which will affect performance;Who's caching them in memory? What are you planning on doing with these CLOBs? There's no real reason they should impact performance any more than anything else, but it depends on your requirements as to how you plan to use them.
    - to manipulate CLOBs you need PL/SQL anonymous block or procedure;You can manipulate CLOBs in SQL too, using the DBMS_LOB package.
    - bind variables cannot be assigned CLOB value;Are you sure?
    - dynamic SQL cannot use CLOBs;Yes it can. 11g supports CLOBs for EXECUTE IMMEDIATE statements and pre 11g you can use the DBMS_SQL package with CLOB's split into a VARCHAR2S structure.
    - temp tables don't work very well with CLOBs;What do you mean "don't work well"?
    - fuzzy logic search on CLOBs is ineffective;Seems like you're pulling information from various sources without context. Again, it depends on your requirements as to how you are going to use the CLOB's
    - not all ODBC drivers support Oracle CLOBs not all, but there are some. Again, it depends what you want to achieve.
    - UNION, MINUS, INTERSECT don't work with CLOBsTrue.
    I have not delt with CLOB data type in the past, so I am hoping to hear from you of any possible issues/hastles we may encounter?You may have more hassle if you "need" to accept more than 4000 characters and you are splitting it into seperate columns or rows, when a CLOB would do it easily.
    It seems as though you are trying to find all the negative aspects of CLOBs and ignoring all the positive aspects, and also ignoring the negative aspects of not using CLOB's.
    Without context you're assumptions are just that, assumptions, so nobody can tell you if it will be right or wrong to use them. CLOB's do have their uses, just as XMLTYPE's have their uses etc. If you're using them for the right reasons then great, but if you're ignoring them for the wrong reasons then you'll suffer.

  • Component to display a CLOB data

    Hi, i'm looking for a component which can render a CLOB type xml data. The expected size of the xml could be upto 6mb which needs to be presented in the xml format. Thanks .

    Thanks for your response. The use case is , we need to show a xml message file which is stored as a CLOB data type(because of it''s size upto 6mb. ). To the user the xml message needs to be presented as in a xml editor. User can view and edit the xml and should able to save it back to database. Thanks .

  • CLOB data import problem from 9.2 to 10.2

    Hello,
    I am exporting data from 9.2 to 10.2 with exp/imp utility.
    I have one table with datatypes NUMBER,VARCHAR2,CLOB,DATE,CHAR. CLOB is having xml data. while importing into 10.2, import failed with the messages
    IMP-00058: ORACLE error 1461 encountered
    ORA-01461: can bind a LONG value only for insert into a LONG column
    IMP-00028: partial import of previous table rolled back
    Pls suggest what is the problem and how to overcome.

    The error message is more telling.
    Did you precreated the table on 10g as CLOB while import LONG into it?
    You can either change LONG to CLOB on 9i first then exp/imp or change 10g table to LONG first and covert to CLOB later.
    ORA-01461: can bind a LONG value only for insert into a LONG column
    Cause: An attempt was made to insert a value from a LONG datatype into another datatype. This is not allowed.
    Action: Do not try to insert LONG datatypes into other types of columns.

Maybe you are looking for

  • Can't authorize another computer with the same account ?

    Hello, I have 2 computers, one older than the other. - on the older, I have the old version of ADE w/ lots of ebooks on it. I had it authorized (created an account etc...). - on the new one, I have recently downloaded the new version of ADE, without

  • Error message IPC 6023 for the Bt sport channels 5...

    Had this problem for a week now and although help desk has been helpful the problem is still not resolved. One chap says its the broadband another says its the youview box.  I have a technical back ground and i think the broadband is working fine Hub

  • Under "CLIP" all featured options are grade out. Please Help!!! Also the blade and blade all are not shown in the tool bar...

    Hello People. I just reinstalled my sound track pro which took me forever, dah . And now I'm having difficulties with using some options that are listed under the  "Clip" they simply all grade out. Also some tools such as blade and blade all are not

  • CSA 5.1(Untrusted Content Classification Module)

    Hi Experts, I am running CSA in my Pilot and its kind of stable now and working Fine.I need to know one thing I hv disabled "Untrusted Content Classification Module" from the Application classification Policy which is part of All Windows Group.I hv d

  • Oracle Enterprise manager 9i

    Hi we are using oracle 9i enterprise manager. And some developers also use through their laptops. So ,Now I have a developer who wants to see her long operations going on through enterprise managers. so how should I set up i.e add another database to