SQLSERVER and BLOB

Hello,
I m trying to insert/retrieve an image from a SqlServer 2000 DB, I have a [Microsoft][SQLServer 2000 Driver for JDBC]. Im allways getting (String or binary data would be truncated.). Can anyone help me , I ve already looked in this forum and on the net but I cant put this to work, I dont know if it is a problem with the table definition or other thing...
my table in sqlserver:
CREATE TABLE DBTEST.dbo.ImageTable ( ImgName VARCHAR PRIMARY KEY, MyImage image );
My code:
public class ImageStream {
     public static void main(String[] args) {
          ImageStream i = new ImageStream();
          i.put("ssfsf");
     void put(String file){
     try{     
          Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver" );
          String url = "jdbc:microsoft:sqlserver://csal1007:1433;DatabaseName=DBTEST"; 
          Connection dbCon = DriverManager.getConnection(url,"sa","");  
          File              fl    = new File("c:\\new.txt");
          FileInputStream   fis   = new FileInputStream( fl );
          PreparedStatement pstmt =
               dbCon.prepareStatement("INSERT INTO  ImageTable(ImgName, MyImage) VALUES (?, ?)");
          pstmt.setString( 1, "teste");
          pstmt.setBinaryStream(2,fis,(int)fl.length());
          pstmt.executeUpdate();
          pstmt.close();
          dbCon.close();
          fis.close();
       }catch(Exception e){ System.out.println("error " + e);}     
}Can any one of U look at this!!! ths should be easy I thought... I m sure lots of U have done something similar... so gimme a help

Hi there,
I use SQL Server 2000 and store binary data.
To do this I use the PreparedStatement method setBytes
So your code would go something like this:
public class ImageStream {
public static void main(String[] args) {
     ImageStream i = new ImageStream();
     i.put("ssfsf");
void put(String file){
try{
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver" );
    String url = "jdbc:microsoft:sqlserver://csal1007:1433;DatabaseName=BTEST";
    Connection dbCon = DriverManager.getConnection(url,"sa","");
    File              fl    = new File("c:\\new.txt");
    FileInputStream   fis   = new FileInputStream( fl );
    long length = fl.length();
    if (length > Integer.MAX_VALUE) {
            // File is too large
    // Create the byte array to hold the data
    byte[] bytes = new byte[ (int) length];
    // Read in the bytes
    int numRead = fis.read(bytes, 0, bytes.length);
    // Close the input stream and return bytes
    fis.close();
    PreparedStatement pstmt =  dbCon.prepareStatement("INSERT INTO  ImageTable(ImgName, MyImage)VALUES (?, ?)");
    pstmt.setString( 1, "teste");
    pstmt.setBytes(2,bytes);
    pstmt.executeUpdate();
    pstmt.close();
    dbCon.close();
    }catch(Exception e){ System.out.println("error " +  e);
>
Hello,
I m trying to insert/retrieve an image from a
SqlServer 2000 DB, I have a [Microsoft][SQLServer 2000
Driver for JDBC]. Im allways getting (String or binary
data would be truncated.). Can anyone help me , I ve
already looked in this forum and on the net but I cant
put this to work, I dont know if it is a problem with
the table definition or other thing...
my table in sqlserver:
CREATE TABLE DBTEST.dbo.ImageTable ( ImgName VARCHAR
PRIMARY KEY, MyImage image );
My code:
public class ImageStream {
public static void main(String[] args) {
ImageStream i = new ImageStream();
i.put("ssfsf");
void put(String file){
try{
Class.forName(
"com.microsoft.jdbc.sqlserver.SQLServerDriver" );
String url =
"jdbc:microsoft:sqlserver://csal1007:1433;DatabaseName=
BTEST";
Connection dbCon =
DriverManager.getConnection(url,"sa","");
File              fl    = new File("c:\\new.txt");
FileInputStream   fis   = new FileInputStream( fl );
PreparedStatement pstmt =
dbCon.prepareStatement("INSERT INTO
ImageTable(ImgName, MyImage) VALUES (?, ?)");
pstmt.setString( 1, "teste");
pstmt.setBinaryStream(2,fis,(int)fl.length());
pstmt.executeUpdate();
pstmt.close();
dbCon.close();
fis.close();
}catch(Exception e){ System.out.println("error " +
e);}
}Can any one of U look at this!!! ths should be easy I
thought... I m sure lots of U have done something
similar... so gimme a help

Similar Messages

  • Out of Order Primary Keys and Blob fields

    Hi,
    I am using Oracle Migration Workbench to transfer the data from SQLServer 2000 to ORacle 9i. I am running into the following issues and was wondering if you had any ideas what may be going on:
    1.) Primary keys are out of order
    2.) Blob fields are inserted into the incorrect row
    Ex. BLOB field stating 'Application active' should be associated with Act_key (primary key) = 5 and it ends up transfering over with act_key 28.
    Thank you for any information you may have on this.
    AK

    I am very interested in this thread because I have encountered a similar problem with BLOB columns, except that I am also seeing this with CLOB's.
    Essentially the all the data gets 'migrated', but the CLOB and BLOB columns are all mixed up!
    Any solutions?

  • How we handle CLOB and BLOB Datatypes in HANA DB

    Dear HANA Gurus,
    We have would like to build EDW using HANA base on our source system Oracle and it's supports CLOB and BLOB datatypes
    Would you please suggest how do we handle in HANA DB.
    Let not say it's oracle specific.
    Regards,
    Manoj

    Hello,
    check SAP HANA SQL Reference Guide for list of data types:
    (page 14 - Classification of Data Types)
    https://service.sap.com/~sapidb/011000358700000604922011
    For this purpose might be useful following data types:
    Large Object (LOB) Types
    LOB (large objects) data types, CLOB, NCLOB and BLOB, are used to store a large amount of data such as text documents and images. The maximum size of an LOB is 2 GB.
    BLOB
    The BLOB data type is used to store large binary data.
    CLOB
    The CLOB data type is used to store large ASCII character data.
    NCLOB
    The NCLOB data type is used to store a large Unicode character object.
    Tomas

  • Data Replication Between Sqlserver and Oracle11g using materialized view.

    I have Sqlserver 2005 as my source and oracle11g as my target.I need to populate the target daily with change data from source.
    for that we have created a dblink between sqlserver and oracle and replicated that table as a Materialized view in Oracle.
    problem we are getting here is Fast refresh option is not available.each day it will pick full data from the source.
    is there any way to use Fast refresh in this scenario??
    Thanks in advance.
    Regards,
    Balaram.

    Pl do not post duplicates - Data Replication Between Sqlserver and Oracle11g using materialized view.

  • Dbms_crypto and blob datatypes

    Hi everyone
    I've been trying to learn how to encrypt data (a file uploaded) using blob datatype. This is me first attempt at encrypting and have been doing some research on this. I need to use the BLOB as I am encrypting a file that is uploaded to the system. Does anyone have experience in this or know of a good example that I can take a look at?
    Ray

    Hello,
    check SAP HANA SQL Reference Guide for list of data types:
    (page 14 - Classification of Data Types)
    https://service.sap.com/~sapidb/011000358700000604922011
    For this purpose might be useful following data types:
    Large Object (LOB) Types
    LOB (large objects) data types, CLOB, NCLOB and BLOB, are used to store a large amount of data such as text documents and images. The maximum size of an LOB is 2 GB.
    BLOB
    The BLOB data type is used to store large binary data.
    CLOB
    The CLOB data type is used to store large ASCII character data.
    NCLOB
    The NCLOB data type is used to store a large Unicode character object.
    Tomas

  • Java and BLOB

    Help...
    I need samples for storing files into BLOB by using Java code.
    Anyone knows?

    Here is my full code:
    /* This program is for testing Java and BLOB function */
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.sql.*;
    public class BlobApplication {
    static Connection con=null;
    // static Statement stmt,stmt1,stmt2,stmt3=null;
    // static ResultSet rs,rs1,rs2,rs3=null;
    // static OracleConnection con=null;
    static OracleStatement stmt,stmt1,stmt2,stmt3=null;
    static OracleResultSet rs,rs1,rs2,rs3=null;
    static String sqlStr,sqlStr1,sqlStr2,sqlStr3="";
    static long blobLength;
         public static void main(String args[]) {
              try{     
                   Class.forName
    ("oracle.jdbc.driver.OracleDriver");
                   //con=(OracleConnection)
    DriverManager.getConnection
    ("jdbc:oracle:thin:@172.18.41.8:1521","EDB","edb");      
                   con=(OracleConnection)
    DriverManager.getConnection
    ("jdbc:oracle:oci8:@t18new","EDB","edb");      
                   //con=DriverManager.getConnection
    ("jdbc:oracle:oci8:@t18new","EDB","edb");      
                   BlobApplication lobApp=new
    BlobApplication();
                   lobApp.insertIntoLobTable("bfile1.dat");
                   //lobApp.insertIntoLobTable
    ("bfile2.dat");
                   //lobApp.insertIntoLobTable
    ("bfile3.dat");
                   lobApp.saveBlobTableToDisk();
                   con.close();     
              } catch (Exception e) {
                   e.printStackTrace();
         void insertIntoLobTable(String blobFilename){
              try {
         stmt=(OracleStatement)con.createStatement
         //stmt=con.createStatement();     
              stmt.execute("insert into lobtable
    (blobfilename,blobdata) values ('"+blobFilename+"', EMPTY_BLOB
              insertBLOB(blobFilename);
    stmt.close();
              catch (SQLException ex) {
                   System.err.println("Could not insert
    into the table lobtable \n"+ex);
                   System.exit(1);
         void insertBLOB(String filename) throws SQLException {
              try {
                   BLOB aBLOB=null;     
                   System.out.println(filename);     
                   File aFile=new File(filename);
                   FileInputStream aFileInputStream=new
    FileInputStream(aFile);               
         stmt1=(OracleStatement)con.createStatement();
         //stmt1=con.createStatement();     
              //sqlStr1="select * from lobtable where
    blobfilename='"+ filename +"' for update";
                   System.out.println("before query");
              rs1=(OracleResultSet)stmt1.executeQuery
    ("select * from lobtable where blobfilename='"+ filename +"' for
    update");               
              //rs1=stmt1.executeQuery(sqlStr1);          
              //stmt1.executeQuery(sqlStr1);
                   System.out.println("after query");
                   while (rs1.next()) {
                   System.out.println("in the loop");
              aBLOB=rs1.getBLOB(2);               
                             //int
    chunkSize=rs1.getBLOB("blobdata").getChunkSize();
                             int
    chunkSize=aBLOB.getChunkSize();
                             byte[] buffer=new byte
    [chunkSize];
                             int lenRead;
                             long offset=1;
                             while
    ((lenRead=aFileInputStream.read(buffer)) != -1) {
                                  if (blobLength<
    offset) buffer=new byte[lenRead];
                                  //rs1.getBLOB
    ("blobdata").putBytes(offset,buffer);
                                  aBLOB.putBytes
    (offset,buffer);
                                  offset+=lenRead;
              rs1.close();
    stmt1.close();                    
                        aFileInputStream.close();
              catch(IOException e) {
                   System.err.println("Error in
    reading "+filename+"\n"+e);
                   System.exit(1);
         void saveBlobTableToDisk() {
              try {
         stmt2=(OracleStatement)
    con.createStatement();     
         //stmt2=con.createStatement();     
              sqlStr2="SELECT blobfilename,blobdata
    FROM LOBTABLE";
              rs2=(OracleResultSet)stmt2.executeQuery
    (sqlStr2);
              //rs2=stmt2.executeQuery(sqlStr2);
                   while (rs2.next()) {     
                        writeBlobToDisk(rs2.getString
    ("blobfilename"), rs2.getBLOB("blobdata"));
              rs2.close();
    stmt2.close();                    
              catch (SQLException ex) {
                   System.err.println("Could not save to
    disk \n"+ex);
                   System.exit(1);
         void writeBlobToDisk(String filename,BLOB readBlob)
    throws SQLException {
              try {
                   File aFile=new File("blob_"+filename);
                   FileOutputStream aFileOutputStream=new
    FileOutputStream(aFile);
                   int chunkSize=readBlob.getChunkSize();
                   byte[] buffer=new byte[chunkSize];
                   blobLength=readBlob.length();
                   for (long pos=1; pos<blobLength;
    pos+=chunkSize) {
                        chunkSize=readBlob.getBytes
    (pos,chunkSize,buffer);
                        aFileOutputStream.write
    (buffer,0,chunkSize);
                   aFileOutputStream.close();
              catch (IOException e) {
                   System.err.println("Error in
    writing "+filename+"\n"+e);
                   System.exit(1);
    } // End of BLobApplication
    -----------------------------------------------------------------

  • Replicating clobs and blobs in a remote database across dblink

    9iR2
    When creating a materialized view in a warehouse pointing to a remote table in an OLTP environment, I got this error when trying to replicate a table with 3 clobs.
    ORA-22992: cannot use LOB locators selected from remote tables
    So, how does Oracle recommend replicating Blobs and Clobs in a remote database/warehouse? Evidently using materialized views doesnt work.

    MV replication is obsolete.
    Move to 10gR2 and use Streams.

  • Associative Array and Blob

    I’m currently working on a system that allows the users to upload an Excel spreadsheet (.xls) in the system. The upload page is a PL/SQL cartridge. Then I’ve written a Java servlet (using Oracle Clean Content) to convert the XLS into a CSV and store it back in the database. (it is stored in the “uploaded_files” table as a blob). I’m trying to create another procedure to read the contents of the blob and display a preview of the data on the screen (using an html table (will be done using cartridge)). After the preview, the user can choose to submit the data into the database into the “detail_records” table or simply discard everything.
    I've been trying to use an associative array to grab all the data from the blob but I’m getting confused about how to implement it in my situation.
    Can someone provide any examples of this nature?
    Any help is greatly appreciated.

    I decided to create a "record" type with all the columns from my excel spreadsheet. Then I will create a table type of records
    I am doing something like this:
    declare
    type s_record is record
                            (l_name varchar2(100),
                             f_code varchar2(4) ,
                             l_code varchar2(6),
                             d_date varchar2(5),
                             d_type varchar2(5),
                             price number,
                             volume number,
                             tax number,
                             amount_paid number
    type s_data_tab is table of s_record index by binary_integer;
    v_s_data s_data_tab;
    v_indx binary_integer :=0;
    begin
    end; I am getting confused about parsing an entire row of values separated by commas into a row in the temporary table created above.
    I know I need a loop, but from what I understand, the way to populate data needs to be something like this, for example:
    for v_indx in 0..data_size loop
       v_s_data(v_indx).l_name:= 'Company A';
       v_s_data(v_indx).f_code := '2700';
    end loop; But I'm not sure how this approach should be used to parse an entire row at once.
    Any help appreciated.

  • Report 6i and Blob

    Currently, I have a word document (BLOB) stored in a table.
    The goal is to fetch the BLOB and display the content of the word doc in the report.
    I've tried to add a report field which maps to the db column as Binary LOB with File Format property = 'text'. (I've also tried File Format property = OLE and few others. none of them works)
    All I am getting is bunch of scrambled character.
    What am I missing here?
    Thanks!

    I looked around Metalink and found...
    Unable to Display Complete MS-Word Document from Oracle Reports [ID 233445.1].
    It mentioned one work around is to transform the ms-doc to a text file.
    However, I am more interesting in what you mentioned earlier... "Split the original in several one page doc."
    Is there a programming way to achieve the goal for splitting the original doc in several pages while save into DB via Oracle Form? or do we just have to split the doc manually?
    Thanks.

  • Sql*loader and blob

    Hi,
    I want to load hex strings with sql loader into a blob/raw fields.
    The problem is that sql functions (e.g. HextoRaw) are not allowed with lob columns, and for the RAW one i get:
    "illegal use of TERMINATED BY for RAW"
    What should i do?

    If each blob is in a separate file, then you should be able to use LOBFILES to load them. Each row in the data file would need to have the name of the file containing the blob for that row. File ulcase9.ctl in the demo directory shows an example of using LOBFILES to load a lob column.
    If you want the blob in the data file, then the data file needs to use types that have include length information in then, such as VARRAW, LONG VARRAW or VARRAWC. Also, the records for the data files cannot be terminated by a character string or newline. That's because the blob data might contain the character string or newline in the middle of its data. Instead, you would need to use the VAR record type.

  • Report 6i and BLOB type of field

    Hi,
    I have a table name logo, fields are:-
    LOGO_NAME varchar2(100)
    LOGO BLOB
    If I used form to load picture and saved into this field, how can i extract the data into report?

    Sorry that I must add also that I am using report 6i

  • PDF Book Binder Processor and blob protocol

    Hello,
    I've 3 questions concerning PDF Book Binder Processor
    1. in the documentation: "Oracle® XML Publisher User’s Guide Release 11i Part No. B13817-06"
    I see a statement:
    "For detailed information, please see OracleMetaLink note 358886.1, "Oracle
    XML Publisher PDF Binding Examples.""
    Unfortunatly I can't find this document on the My Oracle Support.
    Is this document exists ?
    Was anybody was able to find it ?
    2. in the: "Oracle BI Publisher Java API Reference Release 10.1.3.4"
    I see a statement:
    "The format for the "blob://" protocol is:
    blob://[table_name].[blob_column_name]/[pk_datatype]:[pk_name]=[pk_value]/../../..
    Please see "toc-volumes-blob.xml" for an example of how to use this protocol."
    Unfortunatly I can't find this example.
    Does anybody knows where this sample can be found ?
    3. Does anybody use the "blob://" protocol and can share a experiences ?
    I would like to know the way how can I use this blob protocol in the XML control file, where can I declare a connection to the database ?
    Thank you in advance for help.
    Andrzej Raczkowski

    Check out
    http://blogs.oracle.com/xmlpublisher/2008/04/bookbindin_1.html and
    http://blogs.oracle.com/xmlpublisher/2008/04/bookbindin_2.html
    Regards
    Tim

  • Loading Clob and Blob data using DBMS_LOB

    I am loading some data into a table that has five columns, two of which are defined as BLOB and CLOB respectively. I get the following errors after the pl/sql procedure that loads it has completed running :
    ERROR:ORA-21560: argument 3 is null,
    invalid, or out of range
    ERROR:ORA-22297: warning: Open LOBs exist
    at transaction commit time.
    The following is the outline of the code that loads the table:
    CREATE OR REPLACE PROCEDURE load_data(dir,seq_val,file_name,
    details, etc <== all these are passed in) IS
    dest_loc BLOB;
    src_loc BFILE;
    Amount INTEGER;
    new_dir string(1000);
    new_file string(1000);
    BEGIN
    new_dir := ''||dir||'';
    new_file := ''||file_name||'';
    src_loc := BFileName(new_dir,new_file);
    Amount := dbms_lob.getlength(src_loc);
    insert into table A
    (id
    ,ver
    ,ver
    ,fil_nm <== This field is a BLOB
    ,details <== This Field is a CLOB
    values
    (seq_val
    ,1
    ,version
    ,empty_blob()
    ,detailed_infor
    --dbms_output.put_line(Amount);
    SELECT fil_nm INTO dest_loc FROM table A WHERE id = seq_val FOR UPDATE;
    /* Opening the LOB is mandatory: */
    --dbms_output.put_line('IN SELECT...');
    DBMS_LOB.OPEN(src_loc, DBMS_LOB.LOB_READONLY);
    /* Opening the LOB is optional: */
    DBMS_LOB.OPEN(dest_loc, DBMS_LOB.LOB_READWRITE);
    DBMS_LOB.LOADFROMFILE(dest_loc, src_loc, Amount);
    /* Closing the LOB is mandatory if you have opened it: */
    DBMS_LOB.CLOSE(dest_loc);
    DBMS_LOB.CLOSE(src_loc);
    --dbms_output.put_line('After SELECT...');
    COMMIT;
    END
    Any feedback would be really appreciated. Thanks.

    I assume thats when the ORA-21560: argument 3 is null, invalid, or out of range error occurs. I'm also wondering why and what the other error means saying LOBs are open during transaction commit time. The data is coming from an xml file that is in the following format.
    - <NAME>
    <FIL_NM>TEST.PDF</FIL_NM>
    <VER>2</VER>
    <DETAILS>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyzzzzzzzzzmmmmmmsusssuitttttretc</DETAILS>
    </REPORT>
    <NAME/>
    So what this procedure is doing is opening the pdf and loading the data into the BLOB. I just can't understand what is causing those errors.

  • ?Working with clob and blob - using Dbms_Lob

    I need to search through a blob and remove some of the data, but having problems working with dbms_lob.erase.
    Reading the documentation, the procedure is supposed to work with either blobs or clobs, but I can't get it to work with the blob.
    Here's what I've coded and it does not work correctly for blobs.
    What have I've done wrong?
    declare
    v_start                   integer;
    v_stop                    integer;
    v_amount                  integer;
    v_max_len                  integer:=32676;
    v_offset                   integer:=1;
    v_new_length               integer;
    v_clob clob;
    v_blob blob;
    begin
    update test_clob
    set clob_id = clob_id
    where clob_id = 1
    returning clob_desc into v_clob;
    v_start := 0;
    v_stop  := 0;
    v_amount := 0;
    v_start := dbms_lob.instr(v_clob, '<property name="Name">SortMode', v_offset );
    v_stop  := dbms_lob.instr(v_clob, '</property>',  v_start );
    v_amount := ((v_stop - v_start)+11) ;
    dbms_output.put_line('Clob: '||v_clob);
    dbms_lob.erase(v_clob, v_amount, v_start);
    dbms_output.put_line('Clob: '||v_clob);
    rollback;
    update test_clob
    set clob_id = clob_id
    where clob_id = 1
    returning blob_desc into v_blob;
    v_start := 0;
    v_stop  := 0;
    v_amount := 0;
    v_start := dbms_lob.instr(v_blob, utl_raw.cast_to_raw('<property name="Name">SortMode'), v_offset );
    v_stop  := dbms_lob.instr(v_blob, utl_raw.cast_to_raw('</property>'),  v_start );
    v_amount := ((v_stop - v_start)+11) ;
    dbms_output.put_line('Blob: '||utl_raw.cast_to_varchar2(v_blob) );
    dbms_lob.erase(v_blob, v_amount, v_start);
    dbms_output.put_line('Blob: '||utl_raw.cast_to_varchar2(v_blob) );
    rollback;
    end trg_bui_user_assoc_layout;
    /This is the output
    Clob: this is only a test <property name="Name">SortMode</property>  should leave this alone
    Clob: this is only a test                                            should leave this alone
    Blob: this is only a test <property name="Name">SortMode</property>  should leave this alone
    Blob: this is only a test

    Well, you left out the table DDL and your insert for sample data (would be nice to have) as well as your Oracle version (pretty much a necessity).
    Since i had to make my own there could be a difference in how you populated your table, but i can't reproduce your findings.
    ME_ORCL?drop table test_clob purge;
    Table dropped.
    Elapsed: 00:00:00.09
    ME_ORCL?
    ME_ORCL?create table test_clob
      2  (
      3     clob_id     number not null primary key,
      4     clob_desc   clob,
      5     blob_desc   blob
      6  );
    Table created.
    Elapsed: 00:00:00.03
    ME_ORCL?
    ME_ORCL?insert into test_clob values
      2  (
      3        1
      4     ,  'this is only a test <property name="Name">SortMode</property>  should leave this alone'
      5     ,  utl_raw.cast_to_raw('this is only a test <property name="Name">SortMode</property>  should leave this alone')
      6  );
    1 row created.
    Elapsed: 00:00:00.01
    ME_ORCL?
    ME_ORCL?commit;
    Commit complete.
    Elapsed: 00:00:00.01
    ME_ORCL?
    ME_ORCL?declare
      2  v_start                   integer;
      3  v_stop                    integer;
      4  v_amount                  integer;
      5  v_max_len                  integer:=32676;
      6  v_offset                   integer:=1;
      7  v_new_length               integer;
      8
      9  v_clob clob;
    10  v_blob blob;
    11
    12  begin
    13
    14   update test_clob
    15   set clob_id = clob_id
    16   where clob_id = 1
    17   returning clob_desc into v_clob;
    18
    19   v_start := 0;
    20   v_stop  := 0;
    21   v_amount := 0;
    22
    23   v_start := dbms_lob.instr(v_clob, '<property name="Name">SortMode', v_offset );
    24   v_stop  := dbms_lob.instr(v_clob, '</property>',  v_start );
    25   v_amount := ((v_stop - v_start)+11) ;
    26
    27   dbms_output.put_line('Clob: '||v_clob);
    28
    29   dbms_lob.erase(v_clob, v_amount, v_start);
    30
    31   dbms_output.put_line('Clob: '||v_clob);
    32
    33   rollback;
    34
    35   update test_clob
    36   set clob_id = clob_id
    37   where clob_id = 1
    38   returning blob_desc into v_blob;
    39
    40   v_start := 0;
    41   v_stop  := 0;
    42   v_amount := 0;
    43
    44   v_start := dbms_lob.instr(v_blob, utl_raw.cast_to_raw('<property name="Name">SortMode'), v_offset );
    45   v_stop  := dbms_lob.instr(v_blob, utl_raw.cast_to_raw('</property>'),  v_start );
    46   v_amount := ((v_stop - v_start)+11) ;
    47
    48   dbms_output.put_line('Blob: '||utl_raw.cast_to_varchar2(v_blob) );
    49
    50   dbms_lob.erase(v_blob, v_amount, v_start);
    51
    52   dbms_output.put_line('Blob: '||utl_raw.cast_to_varchar2(v_blob) );
    53
    54   rollback;
    55
    56  end trg_bui_user_assoc_layout;
    57  /
    Clob: this is only a test <property name="Name">SortMode</property>  should leave this alone
    Clob: this is only a test                                            should leave this alone
    Blob: this is only a test <property name="Name">SortMode</property>  should leave this alone
    Blob: this is only a test                                            should leave this alone
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.03
    ME_ORCL?select *
      2  from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    5 rows selected.
    Elapsed: 00:00:00.03
    ME_ORCL?

  • Oracle ODBC and BLOB in html

    Hi,
    I would like to ask you if cad I use Oracle-ODBC driver (whuch version) for reading BLOB (LRAW) column in html(asp) - JavaScript.
    create table JPG
    CLZM NUMBER(6) not null,
    JPG_FILE LONG RAW null ,
    <% @ LANGUAGE=JavaScript%>
    <%
    Response.Buffer = true;
    Response.ContentType = "image/jpeg";
    Response.AddHeader("Content-Disposition","attachment; filename=test.jpg");
    Response.CacheControl = "public";
    Response.Expires = 0;
    oConn = Server.CreateObject("ADODB.Connection");
    oConn.Open("DSN=ORACLE;UID=scott;PWD=tiger;");
    // Query SQL to obtain recordset containing gif BLOB
    oRs = oConn.Execute("SELECT JPG_FILE FROM JPG WHERE CLZM='3156'");
    // Obtain local variable of /*
    PicSize = oRs("JPG_FILE").ActualSize;
    Pic = oRs("JPG_FILE").GetChunk(PicSize);
    // ??? Obtain only 4 bytey - why ???
    Response.BinaryWrite(Pic);
    Response.End();
    %>
    Thank's
    Ondrej

    I had the same problem using VBScript.
    What you have to do isread in blocks of let's say 1k in a loop and check wether the return value is exactly 1k, if not you may end your loop.
    Here's my code in VBScript.
    Dim varBlob
    Dim varChunk
    Const chuckSize = 1024
    Do
    varChunk = objRs.Fields("blobField").getChunk(chuckSize)
    varBlob = varBlob & varChunk
    Loop While (len(varChunk) = chuckSize)
    the contents of varBlob is your Picture
    null

Maybe you are looking for

  • /How to call a function in another PowerShell script

    Hi All, I want to use dot-sourced method to call the function from other script,While calling Function.ps1 from the second script there is a Null value in the beginning, How can we ignore this null value or there is a better approach of doing it with

  • Funny symbol & how to get rid of it

    I was working with text a while ago. All is ok. Then suddenly, I don't know how it happen, when I press "T" and start to click on an area where I will put a text, a funny symbol like the one below starts to appear. Can anyone tell me what caused this

  • Approvers are not displaying after Saving the SC and re opening SRM 7.0 PCW

    Hi All, We have implemented PCW SRM7.0 SC workflow, where we have implemented to ES - /SAPSRM/BD_WF_PROCESS & /SAPSRM/BD_WF_AGENTS .... When we are saving any SC and re opening it further then it is not determining any approvers. when I debugged then

  • WRT54G always reseting and very slow speeds.

    I don't know whats going on, I have a WRT54G router thats completely up to date with the firmware and the such. I am connected to it via Ethernet cable, and only use the wireless part for my videogame stuff, so its not just the wireless network thats

  • NO Icp for an account

    Converting HAL to FDM and am having some issues. I have several source files that have IC detail that we do not have in HFM. Some of our source ledgers have IC detail in equity and other places that we do not allow in HFM. Account, ICP, Value Equity,