HOW TO  WRITE DATA INTO A CLOB VARIABLE IN PL SQL-URGENT!!!!!!!

Hi,
In a PLSQL procedure, i need to store all error messages into a CLOB variable and finally RETURN the Clob.
While using DBMS_LOB.wirteappend, i am getting Error like
"INVALID LOB LOCATOR SPECIFIED".
Here is the code sample i used,
CREATE OR REPLACE procedure ErrorAppend
is
clobObj CLOB;
amt binary_integer:=32767;
errormsg varchar2(2000);
BEGIN
for j in 1..3
loop
BEGIN
insert into errortest values(j);
EXCEPTION
WHEN others THEN
errormsg:='ERROR OCCURED '||SQLERRM;
dbms_lob.writeappend(clobObj,amt,errormsg);
END;
commit;
end loop;
dbms_output.put_line(clobObj);
END ErrorAppend;
Here i am not allowed to get empty_clob/clob from the table.
Any help will be apprciated.
rgds,
senthil.

InputStream inputStream = new ByteArrayInputStream(mss.getBytes());Use this to push into the file>
Ummm.... no. InputStreams are for reading, not for writing.
Anyway, OP, you're making a mistake. You're trying to open a stream to a file called "This is for dedo". Use FileOutputStream(File file) constructor or FileOutputStream(String pathToFile). You can then wrap that stream with a PrintWriter or whatever you need.

Similar Messages

  • How to select data into multiple bind variables

    Hi,
    I need to load data into multiple bind variable how to do that
    As of now i am using this
    select a , b into :a, :b from dual
    But i want even a to be loaded into both :a and :c also b to be loaded into :b and :d Please suggest
    Thanks
    Sudhir.

    Thanks much it worked
    Thanks
    Sudhir

  • How to write data into xml through web service

    Hi,
      I have a requirement to write the data into xml through a web service .send me related links and sample code if any.

    hi kiran,
      write the data into xml : We need suitable set of java Beans for handling WebService Data.
       However, there are cases when you may prefer an alternate mapping, or when there just isn't a well-defined mapping for your particular schema construct (xsd:choice is a common example). For these cases, IBM® WebSphere® has introduced a new feature called Custom Data Binding that allows you to integrate alternate data binding technologies like JAX-B, EMF/SDO and XML beans, as well to define your own XML schema to Java mappings. This article provides an overview of the technology and how you can get started integrating it into your application.
    GO THru THis Links :
    http://www-128.ibm.com/developerworks/websphere/library/
    techarticles/0601_gallardo/0601_gallardo.html.
    Hope It Helps.
    Thanks
    Varun CN

  • How to write data into a file

    Hi
    I want to write data from a string into a file. I am created a directory and a .doc file . But when i write this data from a string into .doc file , its give an error : File not found exception
    But, when i check in my directory, a file is created with blank.
    My code is:
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    class createFile {
         public static void main(String[] args) {
    try {
         String mss = "This is for dedo";
         FileInputStream fis;
         FileOutputStream fos;
    File file = new File("C:\\JD\\m4.rtf");
    // Create file if it does not exist
    boolean success = file.createNewFile();
         success = true;
    if (success) {
                   System.out.println("suc");     
                   fis = new FileInputStream(mss);
                   System.out.println(fis);
              fos = new FileOutputStream(file);
              int c;
                   while ((c = fis.read()) != -1) {
         fos.write(c);
                   System.out.println("mss");
              fis.close();
              fos.close();
         System.out.println("created");
    // File did not exist and was created
    } else {
    // File already exists
    } catch (IOException e) {
         System.out.println(e);
    regards
    madhu

    InputStream inputStream = new ByteArrayInputStream(mss.getBytes());Use this to push into the file>
    Ummm.... no. InputStreams are for reading, not for writing.
    Anyway, OP, you're making a mistake. You're trying to open a stream to a file called "This is for dedo". Use FileOutputStream(File file) constructor or FileOutputStream(String pathToFile). You can then wrap that stream with a PrintWriter or whatever you need.

  • How to insert data into a CLOB column

    In UIX XML I used a bc4j:textInput control for a CLOB column and I cannot type any letter in this field....Why ?
    Regards,
    Lucian

    Hello again !
    Here are my findings (Content is a CLOB column; I use UIX XML + BC4J):
    1.If I put:
    <inlineMessage prompt="Content" required="no" vAlign="middle" >
    <contents>
    <bc4j:textInput name="Content" attrName="Content" columns="162" rows="5" />
    </contents>
    </inlineMessage>
    I cannot type any letter in the text Input field !!!!!!
    2. If I put
    <inlineMessage prompt="Content" required="no" vAlign="middle" >
    <contents>
    <bc4j:attrScope name="Content">
    <contents>
    <textInput name="Content" columns="162" rows="5">
    <boundAttribute name="text">
    <bc4j:attrProperty name="value"/>
    </boundAttribute>
    </textInput>
    </contents>
    </bc4j:attrScope>
    </contents>
    </inlineMessage>
    I can type in the textInput field, but I cannot save the text after a certain number of characters. Also I cannot see the saved text. I receive :
    Servlet error: Renderer failed: java.lang.ArrayIndexOutOfBoundsException: -35</PRE></BODY></HTML>
    inside the textInput field.
    Please help me ...
    Regards,
    Lucian

  • How to write data from query into Real time cube?

    Hi All,
    Can anyone explain me step by step how to write data into a real time cube from front end queries.
    Thanks in advance

    Hi
    You can do this using Integrated Planning
    You need to create a aggregation level on the Real Time infocube and can create Planning function/sequence, Variables if needed.
    Then you can create query on this aggregation level and you can make the keyfigures Input ready in property pane and you can change the data and save it into cube.
    Please find below help link which clearly explains step by step about Integrated Planning like creating input ready queries etc.,
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/43/0c033316cd2bc4e10000000a114cbd/frameset.htm
    Regards
    Ravi

  • How to insert more than 32k xml data into oracle clob column

    how to insert more than 32k xml data into oracle clob column.
    xml data is coming from java front end
    if we cannot use clob than what are the different options available

    Are you facing any issue with my code?
    String lateral size error will come when you try to insert the full xml in string format.
    public static boolean writeCLOBData(String tableName, String id, String columnName, String strContents) throws DataAccessException{
      boolean isUpdated = true;
      Connection connection = null;
      try {
      connection = ConnectionManager.getConnection ();
      //connection.setAutoCommit ( false );
      PreparedStatement PREPARE_STATEMENT = null;
      String sqlQuery = "UPDATE " + tableName + " SET " + columnName + "  = ?  WHERE ID =" + id;
      PREPARE_STATEMENT = connection.prepareStatement ( sqlQuery );
      // converting string to reader stream
      Reader reader = new StringReader ( strContents );
      PREPARE_STATEMENT.setClob ( 1, reader );
      // return false after updating the clob data to DB
      isUpdated = PREPARE_STATEMENT.execute ();
      PREPARE_STATEMENT.close ();
      } catch ( SQLException e ) {
      e.printStackTrace ();
      finally{
      return isUpdated;
    Try this JAVA code.

  • How to activate another worksheet in excel file and write data into it

    Hi,
    I am writing an automation program to collect test data and write the data to an excel file.
    The excel file has several worksheets and now I can only write data to one sheet. Can anyone please let me know how to activate another worksheet and write data into it? Thank you very much.

    You can do a search in the Example Finder for more Excel VIs.
    They will give you a clearer idea of how to go about doing things in the way you need.
    - Partha
    LabVIEW - Wires that catch bugs!

  • Inserting data into a Clob

    I need to insert data into a Clob (>8k) and have not been able to determine how
    to do it without using Oracle's extensions to the JDBC JDK.
    Does anyone have a code snippet to show how to populate the Clob in the first
    place?
    Thanks,
    Cully.
    Settings from weblogic.properties:
    weblogic.jdbc.connectionPool.oraclePoolCSA=\
    url=jdbc:oracle:thin:@IHP273:1521:AIRCORE,\
    driver=oracle.jdbc.driver.OracleDriver,\
    loginDelaySecs=1,\
    initialCapacity=1,\
    maxCapacity=2,\
    capacityIncrement=2,\
    allowShrinking=true,\
    shrinkPeriodMins=15,\
    refreshMinutes=10,\
    testTable=dual,\
    props=user=csav2;password=csav2
    weblogic.allow.reserve.weblogic.jdbc.connectionPool.oraclePoolCSA=\
    guest,everyone
    weblogic.allow.reset.weblogic.jdbc.connectionPool.oraclePoolCSA=everyone
    weblogic.allow.shrink.weblogic.jdbc.connectionPool.oraclePoolCSA=everyone
    weblogic.jdbc.TXDataSource.CSATXDataSource=oraclePoolCSA

    Shiva,
    That was it....instead of doing the Blob work all in the same insert
    statement, I grabbed a new sequence and inserted a row with an empty_blob().
    After that I did an update on that row setting the correct value of the
    Blob.
    Thanks for the help!!
    "Shiva Paranandi" <[email protected]> wrote in message
    news:[email protected]...
    I tried with SP2 only and it works. The problems might be that you aregetting a
    null blob. Try inserting an emtpy blob first. Check out this program whichworks
    for me on WLS 6, SP2.
    Shiva.
    Tony Bailey wrote:
    Still getting the NPE. Any other ideas??? Are you able to do this
    successfully on sp2?
    "Shiva Paranandi" <[email protected]> wrote in message
    news:[email protected]...
    Try these two things:
    1. Change your SQL query to "SELECT image FROM " + table + " for
    update";
    2. Also, set conn.setAutoCommit(false);
    Shiva.
    Tony Bailey wrote:
    If I step through the code in the debugger, everything is A-OK up
    until
    the
    getBinaryOutputStream, then I get a NPE. The blob appears to be
    instantiated when I toString() it in the previous line.
    private Blob getBlob(File f, String table)
    throws SQLException
    Connection conn = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    String SQL;
    Blob imgblob = null;
    FileInputStream fis = null;
    OutputStream bos = null;
    try
    conn = dbutil.getConnection();
    SQL = "SELECT image FROM " + table;
    pstmt = conn.prepareStatement(SQL);
    rs = pstmt.executeQuery();
    rs.next();
    imgblob = rs.getBlob("image");
    logger.log(Debug.DEBUG, "DictTblCtrlr.getBlob(): The
    blob
    is: "
    + imgblob);
    fis = new FileInputStream(f);
    bos = ((OracleBlob)imgblob).getBinaryOutputStream();
    byte[] buffer = new byte[65534];
    int length = -1;
    while ((length = fis.read(buffer)) != -1)
    bos.write(buffer, 0, length);
    bos.flush();
    catch (Exception sqle)
    logger.log(Debug.ERROR, "DictTblCtrlr.getBlob(): " +
    sqle.getMessage());
    sqle.printStackTrace();
    throw new SQLException(sqle.getMessage());
    finally
    try { fis.close();  bos.close(); } catch (Exception e)
    dbutil.release(rs, pstmt, conn);
    return imgblob;
    [07-19-2001 03:02:07] DEBUG:DictTblCtrlr.getBlob(): The blob is:
    weblogic.jdbc.rmi.SerialBlob@1f1f12
    [07-19-2001 03:02:23] ERROR:DictTblCtrlr.getBlob():
    java.lang.NullPointerException
    java.sql.SQLException: java.lang.NullPointerException
    at
    weblogic.jdbc.rmi.SerialBlob.getBinaryOutputStream(SerialBlob.java:73)
    at
    com.uctech.psws.persistence.datacontroller.DictionaryTableController.getBlob
    (DictionaryTableController.java:410)
    at
    com.uctech.psws.persistence.datacontroller.DictionaryTableController.insert(
    DictionaryTableController.java:363)
    "Shiva Paranandi" <[email protected]> wrote in message
    news:[email protected]...
    Could you post the exception?
    Shiva.
    Tony Bailey wrote:
    Using the example, I get a NullPointerException when calling
    getBinaryOutputStream() under WL6.0sp2.
    "Filip Hanik" <[email protected]> wrote in message
    news:[email protected]...
    look under
    $BEA_HOME/wlserver6.0sp1/samples/examples/jdbc/oracle/OracleBlobClob.java
    >>>>>>>
    ~
    Namaste - I bow to the divine in you
    ~
    Filip Hanik
    Software Architect
    [email protected]
    www.filip.net
    "Cully Orstad" <[email protected]> wrote in message
    news:[email protected]...
    I need to insert data into a Clob (>8k) and have not been
    able
    to
    determine how
    to do it without using Oracle's extensions to the JDBC JDK.
    Does anyone have a code snippet to show how to populate the
    Clob
    in
    the
    first
    place?
    Thanks,
    Cully.
    Settings from weblogic.properties:
    weblogic.jdbc.connectionPool.oraclePoolCSA=\
    url=jdbc:oracle:thin:@IHP273:1521:AIRCORE,\
    driver=oracle.jdbc.driver.OracleDriver,\
    loginDelaySecs=1,\
    initialCapacity=1,\
    maxCapacity=2,\
    capacityIncrement=2,\
    allowShrinking=true,\
    shrinkPeriodMins=15,\
    refreshMinutes=10,\
    testTable=dual,\
    props=user=csav2;password=csav2
    weblogic.allow.reserve.weblogic.jdbc.connectionPool.oraclePoolCSA=\
    guest,everyone
    weblogic.allow.reset.weblogic.jdbc.connectionPool.oraclePoolCSA=everyone
    >>>>>>>>
    >>>>>>
    >>>>
    >>
    weblogic.allow.shrink.weblogic.jdbc.connectionPool.oraclePoolCSA=everyone
    >>>>>>>>
    weblogic.jdbc.TXDataSource.CSATXDataSource=oraclePoolCSA

  • How to write data in a real-cube from a internal table

    Hello Friends
    as you know, we can load data into cube by data sourc, transform rules.  But now, i want write data into a real-time cube from a interinal table .
    I want to know how can I do it.
    thanks !

    Not possible as there shd be some interface or connectivity shd be there to laod the data..
    possible ways are download to excel using FM GUI_download and use that one as a DS...

  • How to upload data into IT0000 using ABAP-HR program

    Hello,
    I'm required to upload data into multiple infotypes [IT000, 0001, 0002, etc] using single input text file. Can anyone able to guide me, how to upload data into IT0000 using ABAP program ?
    Thanks in advance.
    Regards
    Prabhakar.
    Message was edited by:
            Prabhakara Muthyal

    Example code for HR_MAINTAIN_MASTERDATA to COPY IT0002
    DATA: INT_0002_FINAL TYPE STANDARD TABLE OF PA0002 WITH HEADER LINE.
    DATA: VALUES        LIKE PPROP OCCURS 10 WITH HEADER LINE,
    RETURN        LIKE BAPIRETURN1,.
    LOOP AT INT_0002_FINAL.
          VALUES-INFTY = '0002'.
          VALUES-FNAME = 'P0002-PERNR'.
          VALUES-FVAL  = INT_0002_FINAL-PERNR.
          APPEND VALUES.
          VALUES-INFTY = '0002'.
          VALUES-FNAME = 'P0002-BEGDA'.
          VALUES-FVAL  = INT_0002_FINAL-BEGDA.
          APPEND VALUES.
          VALUES-INFTY = '0002'.
          VALUES-FNAME = 'P0002-ENDDA'.
          VALUES-FVAL  = INT_0002_FINAL-ENDDA.
          APPEND VALUES.
          VALUES-INFTY = '0002'.
          VALUES-FNAME = 'P0002-nachn'.
          VALUES-FVAL  = INT_0002_FINAL-NACHN.
          APPEND VALUES.
          VALUES-INFTY = '0002'.
          VALUES-FNAME = 'P0002-gblnd'.
          VALUES-FVAL  = INT_0002_FINAL-GBLND.
          APPEND VALUES.
          VALUES-INFTY = '0002'.
          VALUES-FNAME = 'P0002-vorna'.
          VALUES-FVAL  = INT_0002_FINAL-VORNA.
          APPEND VALUES.
          VALUES-INFTY = '0002'.
          VALUES-FNAME = 'P0002-rufnm'.
          VALUES-FVAL  = INT_0002_FINAL-RUFNM.
          APPEND VALUES.
          VALUES-INFTY = '0002'.
          VALUES-FNAME = 'P0002-name2'.
          VALUES-FVAL  = INT_0002_FINAL-NAME2.
          APPEND VALUES.
          VALUES-INFTY = '0002'.
          VALUES-FNAME = 'P0002-inits'.
          VALUES-FVAL  = INT_0002_FINAL-INITS.
          APPEND VALUES.
          VALUES-INFTY = '0002'.
          VALUES-FNAME = 'P0002-famst'.
          VALUES-FVAL  = INT_0002_FINAL-FAMST.
          APPEND VALUES.
          VALUES-INFTY = '0002'.
          VALUES-FNAME = 'P0002-gbdat'.
          VALUES-FVAL  = INT_0002_FINAL-GBDAT.
          APPEND VALUES.
          VALUES-INFTY = '0002'.
          VALUES-FNAME = 'P0002-sprsl'.
          VALUES-FVAL  = INT_0002_FINAL-SPRSL.
          APPEND VALUES.
          VALUES-INFTY = '0002'.
          VALUES-FNAME = 'P0002-anzkd'.
          VALUES-FVAL  = INT_0002_FINAL-ANZKD.
          APPEND VALUES.
          VALUES-INFTY = '0002'.
          VALUES-FNAME = 'P0002-natio'.
          VALUES-FVAL  = INT_0002_FINAL-NATIO.
          APPEND VALUES.
    * maintain master data
          CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'
            EXPORTING
              PERNR           = INT_0002_FINAL-PERNR
              ACTIO           = 'COP'
              BEGDA           = INT_0002_FINAL-BEGDA
    *         ENDDA           = INT_0002_FINAL-ENDDA
              SUBTY           = SPACE
              NO_ENQUEUE      = SPACE
              DIALOG_MODE        = '0'
              TCLAS              = 'A'
            IMPORTING
              RETURN1         = RETURN
            TABLES
              PROPOSED_VALUES = VALUES
    *         MODIFIED_KEYS   =
            EXCEPTIONS
              OTHERS          = 1.
          IF RETURN IS INITIAL.
            WRITE:/' Done....'.
          ELSE.
            WRITE:/   RETURN-ID, RETURN-TYPE, RETURN-NUMBER, RETURN-MESSAGE_V1, RETURN-MESSAGE_V2, RETURN-MESSAGE_V3, RETURN-MESSAGE_V4.
          ENDIF.
          CLEAR VALUES.
          REFRESH VALUES.
        ENDLOOP.

  • How to write date format in bdc

    how to write date format in bdc report

    Hi,
         First you have a data decleration i.e data l_format(10) type c.
    now if a variable say l_date which is of sy-datum type, you will have to  <b>write l_date to l_format</b>, this will transfer the date in which you(user) have set the date format in user settings. Never hard code the format such as dd.mm.yyyy. or mm/dd/yyyy because the may have different formats, and the BDC will fails. After you have used write to to new l_format, pass this new value to BDC recording.
    Reward if useful.
    Kiran

  • Unable to write data into excel file when it's close

    Hi,
    I'm facing this problem and it's a bit weird. I'm using the following method to insert data into excel file. But when excel file is close, it unable to write data into the excel sheet. But it was able to write the data into the excel sheet if i open the excel file when running the program.
    Can anyone please tell me what's wrong to the code?
    public int updateLog(String sheet, String no, String cpId, String CatId, String rbtCode, String rbt, String rbtName, String artistName, String price, String rbtFileName, String songId, String msg){
            int result = -1;
            try{
                SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",Locale.ENGLISH);
                String actionDate = formatter.format(new Date());
                rbtName = rbtName.replaceAll("'", "''");
                artistName = artistName.replaceAll("'", "");
                String sql = "insert into [Sheet3$] (Code, CpID, CategoryID, RBTCode, RBT, RBTName, ArtistName, Price, RBTFileName, SongID, UploadStatus, FileUploadedDateTime) ";
                sql = sql + " values ('" + no + "', '" + cpId + "', '" + CatId + "', '" + rbtCode + "', '" + rbt + "', '" + rbtName + "', '" + artistName + "', '" + price + "', '" + rbtFileName + "', '" + songId + "', '" + msg + "', '" + actionDate + "')";
                System.out.println(sql);
                log.writeLog(sql);
                result = stmnt.executeUpdate(sql);
            } catch(Exception e){
                e.printStackTrace();
                log.printStackTrace(e);
            return result;
        public int openConnection(){
            int result = -1;
            try{
                Class.forName(dbDriver);
                c = DriverManager.getConnection(conStr + excelFilePath+";ReadOnly=0;");
                stmnt = c.createStatement();
            } catch(Exception e){
                e.printStackTrace();
                log.printStackTrace(e);
                return -1;
            return 1;
        }Thanks

    HI,
    i hv a doubt regarding reading / opening of a
    password protected Excel file using jxl( java ) .
    How to read / open a password protected Excel file
    thro Java (jxl ) program .plz let me know some
    example also .
    Regards,
    Ramesh P
    845935822cross posting !! answered here
    http://forum.java.sun.com/thread.jspa?threadID=710466&messageID=9507085#9507085

  • I want to write data into eeprom(93LC86) in parallel port using labview?

    I want to write data into eeprom(93LC86) in parallel port using labview? Also I want to read data from EEprom.

    Hi Mr. Mz,
    after having a look to 93LC86-Datasheet I do not see a problem. The self-timing programming cycle of this Chip avoids timing problems; the rest is only logical stuff.
    If you need more general info, how to use the parallel port, I recommend: http://[email protected]/ or
    in case you need an example of SPI-Interface in LabVIEW with paraport - then write to: [email protected]
    You are welcome
    regards
    wha

  • How to insert  data into BLOB column  using sql

    Hi all,
    How to insert data into BLOB column directly using sql .
    create  table temp
      a blob,
      b clob);
    SQL> /
    Insert into temp  values ('32aasdasdsdasdasd4e32','adsfbsdkjf') ;
    ERROR at line 1:
    ORA-01465: invalid hex number
    Please help in this.Thanks,
    P Prakash

    see this
    How to store PDF file in BLOB column without using indirect datastore

Maybe you are looking for