Solved

how to retrieve blob field in sql select statement

Posted on 2011-09-23
6
1,575 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to recover a database from a user managed backup
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

747 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

13 Experts available now in Live!

Get 1:1 Help Now