Solved

how to retrieve blob field in sql select statement

Posted on 2011-09-23
6
1,590 Views
Last Modified: 2012-05-12
I have a field that "hugeblob" type, database is Oracle 10g.  How do I retrieve the value in the field in my sql select statement, i.e. Select answer from dual  (answer is a blob field).
0
Comment
Question by:Mike Johnson
6 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 84 total points
ID: 36587540
You cannot.  You can convert it into hex piece by piece but that is it.

You will likely need to write code to retrieve the binary object and work with it.
0
 
LVL 15

Assisted Solution

by:Devinder Singh Virdi
Devinder Singh Virdi earned 83 total points
ID: 36587665
You can limit your result to few character by using substring function dbms_lob package as

Please read the following link.
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm
0
 
LVL 15

Assisted Solution

by:x77
x77 earned 83 total points
ID: 36588195
Note that you can cast a Blob Data to a Stream:

         Dim Datos = Rdr.GetOracleBlob(2)
         Using BR As New BinaryReader(DirectCast(Datos, Stream))

Note. I am using Oracle.DataAccess
Try
            Dim Rdr = cmd.ExecuteReader
            If Rdr.Read Then
                'Dim Datos = cmd.ExecuteScalar
                Dim Estado = Rdr.GetValue(0)
                Dim activo = Rdr.GetValue(1)
                Dim Datos = Rdr.GetOracleBlob(2)
                Using BR As New BinReader(DirectCast(Datos, Stream))
                    Prj = New Proyecto(BR, False)
                    Prj.Estado = CByte(Estado)
                    Prj.Activo = "1".Equals(activo)
                    Prj.ProyectoPublico = True
                End Using
            End If

        Catch ex As Exception
            MessageBox.Show(ex.Message, "Cargando Proyecto Desde Base de datos")
        End Try

Open in new window

0
 
LVL 68

Expert Comment

by:Qlemo
ID: 37242425
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sql query help 4 45
Processing of multiple cursor 6 35
Delphi Ado Query To Converts Joined Columns Into Rows Based on Primary Key 4 42
mysql joining from the same table 6 37
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now