• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1705
  • Last Modified:

how to retrieve blob field in sql select statement

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
Mike Johnson
Asked:
Mike Johnson
3 Solutions
 
slightwv (䄆 Netminder) Commented:
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
 
Devinder Singh VirdiCommented:
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
 
x77Commented:
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
 
QlemoC++ DeveloperCommented:
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now