Resize a blob column in an Oracle table

I have a table that store pictures from inspections. Occasionally, I will get a 3 or 4 mg file that Oracle Reports will not produce a report because of the size of the photo.
Is there code to resize a blob?

Hi,
Not sure what you mean by "resizing" a blob. You can extract and return a substring of the blob using the dbms_lob supplied package:
SQL> -- get the first 2000 bytes
SQL> select dbms_lob.substr(<blob_column>,2000,1) from <blob_table>;but given the nature of your data, I highly suspect that would be of any use to Oracle Reports or any frontend for that matter.
If by "resizing" a blob, you mean "change the resolution of the pic (blob), on the fly, so that it occupies less space", then I doubt it would be easy to implement using SQL or even PL/SQL.
Just a thought - you may want to program the image resizing logic in a language like Java or C and implement it as a Java Stored Procedure or call it as an external procedure respectively.
pratz

Similar Messages

  • Encrypt a column in a oracle table

    Hello all,
    is it possible to Encrypt and Decrypt a column in a Oracle table. And if possible which method can we use..
    Thanks & Regards
    Pratik Lakhpatwala
    Jr Oracle DBA

    Pratik.L wrote:
    Thank you Sir,
    I tried the link you gave me but while creating the table its giving me the following error
    ERROR at line 4:
    ORA-28336: cannot encrypt SYS owned objects
    Thanks & Regards
    Pratik Lakhpatwala
    Jr Oracle DBA
    ORA-28336: cannot encrypt SYS owned objects
    Cause: An attempt was made to encrypt columns in a table owned by SYS.
    Action: none
    You can't encrypt tables owner by the user SYS

  • How to open a BLOB column stored in oracle using OLE wrappers

    Hello friends
    I have a strange problem, I have OLE objects like, *.doc, *.xls, *.bmp etc all these files have been embedded in oracle database using OLE2.0 & wrapping technology. Well I have to extract this data outof BLOB column from Oracle database & store it in OS file in its respective format
    For Eg. If the BloB data which has been embedded in Oracle database using OLE2.0 & wrapping is of *.doc file then the OS file which I have stored after extraction I should be able to open in MS word.
    Well in this task I am able to extract the file using GETCHUNK feature from VB , but I am not able to open the OS file in MS word as it is saying the error
    the document you are trying to open is not supported by MS Word
    So please any one of you can help me to solve this problem I wil be very helpful. also if you have suported code for ths problem It is welcome
    Not only using VB if you have code of any other langauges also itis welcomed
    Thanks
    Adhem

    Please "Preview" your future posts. Your formatting is awful. Especially learn to use the [ code ] tags.
    Are you sure DateTime.Now.ToString() returns a string in the format of 'MM/DD/YYYY HH:MI:SS.FF3'?
    Fix that and if you still having the problems, debug the actual result of your string.Format() and post that.

  • Putting a .pdf file into a column in an oracle table

    I have created a table with one column as a blob so I can put 4800 .pdf files into that column of a table. Can anyone correct the ways I am trying to do this or let me know of a better way. I have tried several ways and have not been successful. Thanks.
    Here are the two ways I have tried that haven't worked.
    -- the storage table for the image file
    CREATE TABLE pdm (
    dname VARCHAR2(30), -- directory name
    sname VARCHAR2(30), -- subdirectory name
    fname VARCHAR2(30), -- file name
    iblob BLOB); -- image file
    -- create the procedure to load the file
    CREATE OR REPLACE PROCEDURE load_file (
    pdname VARCHAR2,
    psname VARCHAR2,
    pfname VARCHAR2) IS
    src_file BFILE;
    dst_file BLOB;
    lgh_file BINARY_INTEGER;
    BEGIN
    src_file := bfilename('O:\twilliams\DD_promotion\cards\', pfname);
    -- insert a NULL record to lock
    INSERT INTO pdm
    (dname, sname, fname, iblob)
    VALUES
    (pdname, psname, pfname, EMPTY_BLOB())
    RETURNING iblob INTO dst_file;
    -- lock record
    SELECT iblob
    INTO dst_file
    FROM pdm
    WHERE dname = pdname
    AND sname = psname
    AND fname = pfname
    FOR UPDATE;
    -- open the file
    dbms_lob.fileopen(src_file, dbms_lob.file_readonly);
    -- determine length
    lgh_file := dbms_lob.getlength(src_file);
    -- read the file
    dbms_lob.loadfromfile(dst_file, src_file, lgh_file);
    -- update the blob field
    UPDATE pdm
    SET iblob = dst_file
    WHERE dname = pdname
    AND sname = psname
    AND fname = pfname;
    -- close file
    dbms_lob.fileclose(src_file);
    END load_file;
    This one I get an error message on this statements:(dbms_lob.LOADBLOBFROMFILE(blob_loc,bfile_loc,dbms_l ob.lobmaxsize,bfile_offset,
    blob_offset) ; )
    DECLARE
    bfile_loc BFILE;
    blob_loc BLOB;
    bfile_offset NUMBER := 1;
    blob_offset NUMBER := 1;
    tot_len INTEGER;
    BEGIN
    /*-- First INSERT a row with an empty blob */
    INSERT INTO blob_tab VALUES (5, EMPTY_BLOB());
    COMMIT;
    /*-- SELECT the blob locator FOR UPDATE */
    SELECT blob_data INTO blob_loc FROM blob_tab
    WHERE id = 5 FOR UPDATE;
    /*- Obtain the BFILE locator */
    bfile_loc := bfilename('O:\twilliams\DD_promotion\cards\','00EAL.pdf');
    /*-- Open the input BFILE */
    dbms_lob.fileopen(bfile_loc, dbms_lob.file_readonly);
    /*-- Open the BLOB */
    dbms_lob.OPEN(blob_loc, dbms_lob.lob_readwrite);
    /*-- Populate the blob with the whole bfile data */
    dbms_lob.LOADBLOBFROMFILE(blob_loc,bfile_loc,dbms_l ob.lobmaxsize,bfile_offset,
    blob_offset) ;
    /*-- Obtain length of the populated BLOB */
    tot_len := DBMS_LOB.GETLENGTH(blob_loc);
    /*-- Close the BLOB */
    dbms_lob.close(blob_loc);
    /*-- Close the BFILE */
    dbms_lob.fileclose(bfile_loc);
    COMMIT;
    /*-- Display the length of the BLOB */
    DBMS_OUTPUT.PUT_LINE('The length of the BLOB after population is: '||
    TO_CHAR(tot_len));
    END ;
    /

    CREATE TABLE test_blob (
    id NUMBER(15)
    , file_name VARCHAR2(1000)
    , image BLOB
    , timestamp DATE
    CREATE OR REPLACE DIRECTORY
    EXAMPLE_LOB_DIR
    AS
    'O:\twilliams\DD_promotion\cards\'
    CREATE OR REPLACE PROCEDURE Load_BLOB_from_file_image
    AS
    dest_loc BLOB;
    src_loc BFILE := BFILENAME('EXAMPLE_LOB_DIR', '009-1395.pdf');
    BEGIN
    INSERT INTO test_blob (id, file_name, image, timestamp)
    VALUES (1001, '009-1395.pdf', empty_blob(), sysdate)
    RETURNING image INTO dest_loc;
    DBMS_LOB.OPEN(src_loc, DBMS_LOB.LOB_READONLY);
    DBMS_LOB.OPEN(dest_loc, DBMS_LOB.LOB_READWRITE);
    DBMS_LOB.LOADFROMFILE(
    dest_lob => dest_loc
    , src_lob => src_loc
    , amount => DBMS_LOB.getLength(src_loc));
    DBMS_LOB.CLOSE(dest_loc);
    DBMS_LOB.CLOSE(src_loc);
    COMMIT;
    END;
    I am getting this error when I exec load_blob_from_file_image.
    ERROR at line 1:
    ORA-00972: identifier is too long
    ORA-06512: at "SYS.DBMS_LOB", line 716
    ORA-06512: at "DRAWING.LOADBLOBFROMFILEIMAGE", line 15
    ORA-06512: at line 1
    any ideas why?

  • How to change the location of a column in a Oracle table?

    Sir:
    I want to add a new column in a table, but I dont want to add the column at the last of the table, how can I do it ? If I want to modify the locations of columns in a table, How can do it?
    Thanks

    You can't modify the order of columns in a table, though there shouldn't be any particular reason to care about the order of columns.
    You can always create a view over the table that SELECT's the columns in the order you want, though.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • BLOB column says undefined

    Hi .
    when i create a BLOB column in the table and describe the structure it says undefined. how do i fix that. also if someone can let me know how to update a RTF content from a VB to the BLOB column in the oracle table?? Tons of thanks in advance

    You can write a BLOB- VB to Oracle database using ADO function in VB. Search in MSDN for help on BLOB function. They have a ready eg.
    Just in case you don't find it.
    Here it is:
    Just copy paste this in a form with text boxes for all ODBC parameters.
    I think you cannot read directly from a BLOB column. Don't forget to initiate a BLOB column like:
    /*LOB table for storing files*/
    Drop table FileColumn;
    Create table FileColumn
    ( REPQUE_ID NUMBER(10) NOT NULL ,
    RepText_blob BLOB default empty_blob()
    Storage (initial 50K next 50K pctincrease 0)
    tablespace TEST31ORA
    lob(RepText_blob) store as
    (tablespace ACCOUNT4
    Storage (initial 100k next 100k pctincrease 0)
    chunk 16k pctversion 10 nocache logging);
    /*initialize LOB locator by making it not null, use empty lob, this will
    insert the locator value in that column
    I did this initialize in create table script, so that I can do the bulk insert
    One can do bulk inserts if there are no rows before
    insert into FileColumn
    values(1, empty_blob()); */
    Option Explicit
    Const BlockSize = 32768
    ' FUNCTION: ReadBLOB()
    ' PURPOSE:
    ' Reads a BLOB from a disk file and stores the contents in the
    ' specified table and field.
    ' PREREQUISITES:
    ' The specified table with the OLE object field to contain the
    ' binary data must be opened in Visual Basic code (Access Basic
    ' code in Microsoft Access 2.0 and earlier) and the correct record
    ' navigated to prior to calling the ReadBLOB() function.
    ' ARGUMENTS:
    ' Source - The path and filename of the binary information
    ' to be read and stored.
    ' T - The table object to store the data in.
    ' Field - The OLE object field in table T to store the data in.
    ' RETURN:
    ' The number of bytes read from the Source file.
    Function ReadBLOB(Source As String, T As Recordset, _
    sField As String)
    Dim NumBlocks As Integer, SourceFile As Integer, i As Integer
    Dim FileLength As Long, LeftOver As Long
    Dim FileData As String
    Dim RetVal As Variant
    On Error GoTo Err_ReadBLOB
    ' Open the source file.
    SourceFile = FreeFile
    Source = "c:\blob_file_folder\G63JR557.doc"
    T = mwebRepOutput
    sField = RepOut_Content
    Open Source For Binary Access Read As SourceFile
    ' Get the length of the file.
    FileLength = LOF(SourceFile)
    If FileLength = 0 Then
    ReadBLOB = 0
    Exit Function
    End If
    ' Calculate the number of blocks to read and leftover bytes.
    NumBlocks = FileLength \ BlockSize
    LeftOver = FileLength Mod BlockSize
    ' SysCmd is used to manipulate status bar meter.
    RetVal = SysCmd(acSysCmdInitMeter, "Reading BLOB", _
    FileLength \ 1000)
    ' Put first record in edit mode.
    T.MoveFirst
    T.Edit
    ' Read the leftover data, writing it to the table.
    FileData = String$(LeftOver, 32)
    Get SourceFile, , FileData
    T(sField).AppendChunk (FileData)
    RetVal = SysCmd(acSysCmdUpdateMeter, LeftOver / 1000)
    ' Read the remaining blocks of data, writing them to the table.
    FileData = String$(BlockSize, 32)
    For i = 1 To NumBlocks
    Get SourceFile, , FileData
    T(sField).AppendChunk (FileData)
    RetVal = SysCmd(acSysCmdUpdateMeter, BlockSize * i / 1000)
    Next i
    ' Update the record and terminate function.
    T.Update
    RetVal = SysCmd(acSysCmdRemoveMeter)
    Close SourceFile
    ReadBLOB = FileLength
    Exit Function
    Err_ReadBLOB:
    ReadBLOB = -Err
    Exit Function
    End Function
    null

  • Stuck threads reading blob column from db table

    WLS 10.3.5, JDK 1.6u29, Oracle 11g RAC, ojdbc6 latest driver
    We're having problems with stuck threads trying to read a blob column from a DB table. The query to extract the blob is a simple select, without any locking such as "for update" clauses or whatever. The blob's size is <= 100k.
    The thread dump shows the following stack trace:
    +"[STUCK] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'" RUNNABLE native+
    +     java.net.SocketInputStream.socketRead0(Native Method)+
    +     java.net.SocketInputStream.read(SocketInputStream.java:129)+
    +     oracle.net.ns.Packet.receive(Packet.java:300)+
    +     oracle.net.ns.DataPacket.receive(DataPacket.java:106)+
    +     oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:315)+
    +     oracle.net.ns.NetInputStream.read(NetInputStream.java:260)+
    +     oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:105)+
    +     oracle.jdbc.driver.T4CMAREngine.getNBytes(T4CMAREngine.java:1517)+
    +     oracle.jdbc.driver.T4C8TTILobd.unmarshalLobData(T4C8TTILobd.java:476)+
    +     oracle.jdbc.driver.T4C8TTILob.readLOBD(T4C8TTILob.java:770)+
    +     oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:361)+
    +     oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)+
    +     oracle.jdbc.driver.T4C8TTILob.read(T4C8TTILob.java:146)+
    +     oracle.jdbc.driver.T4CConnection.getBytes(T4CConnection.java:2392)+
    +     oracle.sql.BLOB.getBytes(BLOB.java:348)+
    +     oracle.sql.BLOB.getBytes(BLOB.java:222)+
    +     weblogic.jdbc.wrapper.Blob_oracle_sql_BLOB.getBytes(Unknown Source)+
    +     com.ibatis.sqlmap.engine.type.BlobTypeHandlerCallback.getResult(BlobTypeHandlerCallback.java:33)+
    +     com.ibatis.sqlmap.engine.type.CustomTypeHandler.getResult(CustomTypeHandler.java:52)+
    +     com.ibatis.sqlmap.engine.mapping.result.ResultMap.getPrimitiveResultMappingValue(ResultMap.java:619)+
    +     com.ibatis.sqlmap.engine.mapping.result.ResultMap.getResults(ResultMap.java:345)+
    +     com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:384)+
    +     com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:300)+
    +     com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:189)+
    +     com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221)+
    +     com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189)+
    +     com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)+
    +     com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)+
    +     com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)+
    +     com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)+
    +     com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:94)+
    +     com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForList(SqlMapDaoTemplate.java:282)"[STUCK] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'" RUNNABLE native+
    +     java.net.SocketInputStream.socketRead0(Native Method)+
    +     java.net.SocketInputStream.read(SocketInputStream.java:129)+
    +     oracle.net.ns.Packet.receive(Packet.java:300)+
    +     oracle.net.ns.DataPacket.receive(DataPacket.java:106)+
    +     oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:315)+
    +     oracle.net.ns.NetInputStream.read(NetInputStream.java:260)+
    +     oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:105)+
    +     oracle.jdbc.driver.T4CMAREngine.getNBytes(T4CMAREngine.java:1517)+
    +     oracle.jdbc.driver.T4C8TTILobd.unmarshalLobData(T4C8TTILobd.java:476)+
    +     oracle.jdbc.driver.T4C8TTILob.readLOBD(T4C8TTILob.java:770)+
    +     oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:361)+
    +     oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)+
    +     oracle.jdbc.driver.T4C8TTILob.read(T4C8TTILob.java:146)+
    +     oracle.jdbc.driver.T4CConnection.getBytes(T4CConnection.java:2392)+
    +     oracle.sql.BLOB.getBytes(BLOB.java:348)+
    +     oracle.sql.BLOB.getBytes(BLOB.java:222)+
    +     weblogic.jdbc.wrapper.Blob_oracle_sql_BLOB.getBytes(Unknown Source)+
    +     com.ibatis.sqlmap.engine.type.BlobTypeHandlerCallback.getResult(BlobTypeHandlerCallback.java:33)+
    +     com.ibatis.sqlmap.engine.type.CustomTypeHandler.getResult(CustomTypeHandler.java:52)+
    +     com.ibatis.sqlmap.engine.mapping.result.ResultMap.getPrimitiveResultMappingValue(ResultMap.java:619)+
    +     com.ibatis.sqlmap.engine.mapping.result.ResultMap.getResults(ResultMap.java:345)+
    +     com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:384)+
    +     com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:300)+
    +     com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:189)+
    +     com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221)+
         com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189)
    +     com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)+
    +     com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)+
    +     com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)+
    +     com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)+
    +     com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:94)+
    +     com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForList(SqlMapDaoTemplate.java:282)+
    Some threads eventually end (after 1-2 hours), most of them remain there for days.
    Any hint would be quite useful, thanks.

    Threads are executing the actual allocated request from the Weblogic Kernel. Most of the problems happen when the Thread execution is reaching the application or business layer.
    At this point your application Java code module is sending or receiving data from external sources such as a an Oracle database for example. Any problem with such external system will cause the Thread to hang and wait for data to come back.
    Other situations can occur such as internal deadlock, infinite looping, heavy IO contention on your server etc.
    Doesn't loo like a driver issue.
    http://docs.oracle.com/cd/E21764_01/doc.1111/e14770/weblogic_server_issues.htm#autoId2
    Check at the Database end
    Cheers ...

  • Column not found error while populatin a oracle table with ODI USer

    Hi,
    I am trying to populate a column in a oracle table with the ODI USER name using the function getUser("USER_NAME") in the Mapping column of the Interface, But the interface throwhing an error *Column not found : Supervisor in Statement [Select......]*. but it's working fine with getUser("I_USER') the column is populating the user identifier.
    can any one help me out why user is not populating.
    Thanks

    Enclose the call to the getUser api inside single quotes
    '<%=getUser("USER_NAME")%>'ID being a number can be used directly but USER_NAME returns a string that needs to be quoted

  • How to create  hidden column in Oracle Table

    Hi folks
    i have one doubt regarding hidden column creation in Oracle Table..
    Let me briefly explain my requirements.
    I have one table called UWRMC_MAST is table contain the following columns
            RMC_N_ID           NUMBER(10)                    NOT NULL,
           COB_N_ID           NUMBER(2)                      NOT NULL,
           SUBCOB_N_ID     NUMBER(2),
           RMC_C_CODE      VARCHAR2(10 BYTE)         NOT NULL,
           RMC_C_NAME      VARCHAR2(100 BYTE)       NOT NULL,
           CREATED_N_BY   NUMBER(10)                     NOT NULL,
           CREATED_D_DT   DATE                              NOT NULL,
           MODIFIED_N_BY  NUMBER(10)                     NOT NULL,
           MODIFIED_D_DT  DATE                              NOT NULL,
           RECORD_N_STS   NUMBER(1)                      NOT NULL,
           RMC_C_REMARKS VARCHAR2(256 BYTE),
           EFFECT_D_DT     DATE                           NOT NULL
    RMC_N_ID is primary key
    i want to create one column like Old_EFFECT_D_DT as virtual column
    when ever i update the effective date that date should be insert into Old_EFFECT_D_DT i.e., Virtual Column
    For example
    SQL> select RMC_N_ID, COB_N_ID, SUBCOB_N_ID, RMC_C_CODE, EFFECT_D_DT from uwrmc_mast;
      RMC_N_ID   COB_N_ID SUBCOB_N_ID RMC_C_CODE EFFECT_D_
            46          1          74 PCTMOTR    02-FEB-11
    Below i update the effective date(01-feb-2011
    SQL> update uwrmc_mast
      2  set EFFECT_D_DT = '01-apr-2011'
      3  where rmc_n_id =46;
    1 row updated.
    But i want a result like below
    SQL> select RMC_N_ID, COB_N_ID, SUBCOB_N_ID, RMC_C_CODE, EFFECT_D_DT from uwrmc_mast;
      RMC_N_ID   COB_N_ID SUBCOB_N_ID RMC_C_CODE EFFECT_D_   OLD_EFFE
            46          1          74 PCTMOTR    01-APR-11   02-FEB-11Is this possible to do in oracle , kindly give a solution for my requirement
    Regards
    Arun

    Arun wrote:
    Hi Mr.David_Aldridge
    Am having the doubt that's why i posted my quires in oracle forums.. just i want to know whether my requirement suit for VIRTUAL COLUMN in Table.
    Regards,
    ArunWell, I'm not sure exactly what your requirement is.
    If you want to audit changes to the records of that table then it would be better to use Oracle's auditing facility. If this previous change date is really a required part of your actual application functionality then you might use the application itself to maintain the previous date as a column in the table, as you say, or if you need to maintain the history of changes then add a new table so you can keep track of multiple changes.

  • How to get oracle 9i blob column into an itab  in sap using Native SQL

    Hi ,
    We are using SAP ECC 5.0  and we need to coonect to an oracle database ver 9i rel2.
    We need to get the data stored in a blob(pdf/jpeg) into an itab and later
    use it for futher processing.
    I am familiar with using native SQL and I wrote a stored procedure in the non sap oracle database to send the blob info into an internal table in sap.
    But the information is in hex format and the long raw of SAP does not handle this very well.
    Plz see my code below.
    data: itab_insp_drawing like zpicture_cluster(which is of type lraw - 7902 )
          occurs 100 with header line.
    EXEC SQL.
        EXECUTE PROCEDURE
           proc_get_insp_drawings  (
                   IN  :itab-aq_id,
                   IN  :itab-section_id,
                   IN  :t_in_position,
                   out :itab_insp_drawing-picture,
                   OUT :t_blob_length,
                   out :t_out_position,
                   OUT :t_status  )
       ENDEXEC.
      append itab_insp_drawing.
      while t_out_position < t_blob_length.
       EXEC SQL.
        EXECUTE PROCEDURE
           proc_get_insp_drawings  (
                   IN  :itab-aq_id,
                   IN  :itab-section_id,
                   IN  :t_in_position,
                   out :itab_insp_drawing-picture,
                   OUT :t_blob_length,
                   out :t_out_position,
                   OUT :t_status  )
       ENDEXEC.
       append itab_insp_drawing.
       endwhile.
    Any ideas of how to handle blobs from non sap oracle table. I need this blob into an itab in sap.
    Help appreciated.
    Thanks
    Mala

    Please refer the example in this link which deals with Oracle date format.
    You can finnd a command DECODE which is used for date formats. If you have a look at whole theory then you will get an idea.
    Link:[Bulk insert SQL command to transfer data from SAP to Oracle|http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bulk-insert-sql-command-to-transfer-data-from-sap-to-oracle-cl_sql_connection-3780804]

  • Problem inserting large files into a Blob-Column

    hi all,
    i am using a oracle 10g database.
    i defined a table including one blob column as follows:
    create table contact(
    id     number(22) primary key not null,
    lastupdated date not null,
    lastwriter_id number(22) not null,
    contacttype_id number(22) not null,
    notice varchar2(2000),
    attachment blob,
    attachmentname varchar2(255))
    tablespace users
    storage (initial 2M pctincrease 0)
    lob (attachment) store AS (
    tablespace users
    storage (initial 10M)
    enable storage in row
              pctversion 5
              chunk 1
    index lob_attachment_idx (tablespace users storage (initial 1M)));
    now i fill this table from a java application using hibernate.
    small files (for example 2700 chars) are ok, the pass into the attachment column.
    larger files dont go there. i receive no errormessage.
    whats going wronr?
    ist my create table statement wrong?
    thnax for help dieter

    Quick and dirty testcase:
    test@ORA10G>
    test@ORA10G> --
    test@ORA10G> drop table t;
    Table dropped.
    test@ORA10G> create table t (x blob);
    Table created.
    test@ORA10G>
    test@ORA10G> insert into t (x)
      2  select utl_raw.cast_to_raw(rpad('a',1000,'x')) from dual;
    1 row created.
    test@ORA10G>
    test@ORA10G> commit;
    Commit complete.
    test@ORA10G>
    test@ORA10G> --
    test@ORA10G> select dbms_lob.getlength(x) as len, dbms_lob.substr(x,10,1) as chunk from t;
           LEN CHUNK
          1000 61787878787878787878
    test@ORA10G>
    test@ORA10G>pratz

  • Full text search in BLOB columns NOT Working

    Hi, I am using Oracle 9i.
    Presently I use following code to create index.
    begin
    Ctx_Ddl.Drop_Preference ('text_only');
    end;
    begin
    Ctx_Ddl.Create_Preference ( 'text_only', 'basic_lexer');
    Ctx_Ddl.Set_Attribute ( 'text_only', 'index_text', 'true' );
    Ctx_Ddl.Set_Attribute ( 'text_only', 'index_themes', 'false' );
    end;
    CREATE TABLE MY_XML_DOCS(
    XML_RES_ID NUMBER (16) NOT NULL,
    XML_RES BLOB NOT NULL,
    XML_RES_PATH VARCHAR2 (128),
    XML_DOCS_CREATED_BY VARCHAR2 (16) NOT NULL,
    XML_DOCS_CREATED_DT DATE NOT NULL,
    XML_DOCS_MODIFIED_BY VARCHAR2 (16),
    XML_DOCS_MODIFIED_DT DATE ) ;
    drop index FULL_TEXT_INDEX ;
    create INDEX FULL_TEXT_INDEX ON MY_XML_DOCS(XML_RES)
    INDEXTYPE IS ctxsys.CONTEXT
    parameters ('lexer text_only stoplist ctxsys.empty_stoplist');
    BEGIN
    CTX_DDL.sync_index('FULL_TEXT_INDEX ','10M');
    END;
    And I've some XML documents stored in blob columns in the above table. But my query with 'contains' param does not return expected results.(it presently returns no results). Do I miss anything? Do I need to specify any thing else while I create the Index? Kindly advice.

    I would agree the CLOB storage would be preferable for XML. If you are using BLOB storage, by default the documents are going to be FILTERed by the INSO_FILTERS. A BLOB column will give you reduced storage in a unicode environment though.
    If you wish to store your data in a BLOB though, you should specify the NULL_FILTER in your create index statement to avoid having the INSO_FILTERS invoked.
    Further, you may also require a CHARSET column in your table specifying the character set of your data for each row if it can vary. The Column should then also be specified in the 'PARAMETERS' clause of the create index statement, this way Oracle knows the correct character set to use when converting the binary data to character data.
    My guess that you are not getting any query results because none of the documents are actually being indexed. Be sure to query the ctx_user_index_errors view to determine if you are getting errors at indexing time.

  • Processing OrdImage data into a BLOB column

    Hi,
    I am importing 30Mb Tiff images into an ordsys.ordimage column within an image table. All is fine with the import part. I now want to populate a blob column in the same table with a jpeg generated from the tiff. I have tried many variations of the .process and .processcopy functions but I'm getting nowhere. Can anyone help?

    You will need to tell us more about what "getting nowhere" means. Are you getting errors? Or do you just not know where to begin? I'll assume the latter.
    First of all, you definitely want to use the processCopy() method. process() will overwrite your original TIFF image. If you want the JPEG in a separate column, you must use processCopy to keep the original and create a new copy. Does your JPEG image have to be in a BLOB column? Why don't you store this in an ORDImage column as well? If you store it in an ORDImage column, you can use the processCopy method. If you must use a BLOB column, you need to look at the processCopy procedure of the relational interface.
    The interMedia Quick Start Guide for the Object Interface (there is also one for the relational interface if you really must use a BLOB column for your JPEG image column), has a good example of using the processCopy method to create a JPEG thumbnail. You can find it here:
    http://www.oracle.com/technology/sample_code/products/intermedia/files/quickstart_guides/intermedia_qs_image.pdf
    See the section on Creating Thumbnails and Changing Formats.
    If you have selected the source image into an ORDImage variable imgSrc, and the destination image into a variable imgDst, the process command to create a similar JPEG image is:
    imgSrc.processCopy('fileformat=jfif', imgDst);

  • Help! Problem Updating Blob Columns

    Good day
    Please i have problems updating Blob columns storing images and doc files. can someone put me through the way out hassle free
    Thank You
    God Bless U all
    Femi

    I keep geting this error
    java.sql.SQLException: ORA-01729: database link name expected
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:955)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1169)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3368)
    when ever i try to update The Blob colum with a Blob object retrieved by resultset.getBlob from another Blob column of a different table.
    Blob b = rset.getBlob(1);
    String x = (String)jComboBox2.getSelectedItem();     
         ps=c.prepareStatement("UPDATE PROPERTIES SET "+x+" = "+b+" WHERE NAME = ?");
         ps.setString(1, (String)jComboBox1.getSelectedItem());
         System.out.println("success");
         ps.executeUpdate();

  • What is wrong with adding a BLOB column?

    What is wrong with adding a BLOB column?
    SQL>  alter table employee_dp add photo(blob(3000000);
    alter table employee_dp add photo(blob(3000000)
    ERROR at line 1:
    ORA-00902: invalid datatype
    SQL> alter table employee_dp add photo bolob(3000000);
    alter table employee_dp add photo bolob(3000000)
    ERROR at line 1:
    ORA-01735: invalid ALTER TABLE option

    Hi jetq,
    Don't give length.
    SQL> alter table t add photo blob;
    Table altered.Regards
    Peter

Maybe you are looking for