Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

how to retrieve blob field in sql select statement

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Fill Null values 5 28
oracle date format checking 7 26
SQL - format decimal in a string 5 38
SSRS: Why is Visual Studio stripping these properties? 2 18
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

792 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