469,267 Members | 1,643 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,267 developers. It's quick & easy.

Can't save BLOB field with Stored Procedure but with Command Text !

Hello,
I'm trying to save a jpg file of 300KB as a BLOB field in an Oracle
10g Database.
If I try to call a Stored Procedure, it fails.
If I use CommandText with SQL sentence, it success.

I can't save the jpg file as a BLOB field using this Method (I'm
calling a Stored Procedure):

Private Sub save_BLOB(ByVal Photo As Byte())
Dim conOP As OracleConnection = ClasesOP.oraConexion()
conOP.Open()
Dim Tran As OracleTransaction = conOP.BeginTransaction
Dim cm As New OracleCommand
cm = conOP.CreateCommand()
cm.Transaction = Tran
cm.Parameters.Clear()
cm.CommandText = "MyPkg.sp_Save_Blob"
cm.CommandType = CommandType.StoredProcedure

cm.Parameters.Add(New OracleParameter("i_MyID",
OracleType.Int32)).Value = Session("MyID")
cm.Parameters.Add(New OracleParameter("i_img_simbolo",
OracleType.Blob)).Value = Photo
Try
cm.ExecuteNonQuery()
Tran.Commit()
Catch ex As Exception
Throw ex
End Try

cm.Dispose()
conOP.Close()
conOP.Dispose()
End Sub

But if I use this CommandText instead of calling a Stored Procedure, I
can save the BLOB field :

cm.CommandText = "Update TBL_OP Set IMG_SIMBOLO_OP =
:i_img_simbolo WHERE Cod_OP = " + Session("MyID")
cm.CommandType = CommandType.Text

cm.Parameters.Add(New OracleParameter("i_img_simbolo",
OracleType.Blob)).Value = Photo

It is something to do with the size of the file. If the size of jpg
file is less than 30KB, it's OK. I can save it as a BLOB field using
Stored Procedure or CommandText using SQL sentence.
However, I need to call allways a Stored Procedure, not SQL sentences
from ASPX pages.
How could I accomplish that, please?

Nov 20 '06 #1
0 2100

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Chris Fink | last post: by
9 posts views Thread by charliewest | last post: by
5 posts views Thread by Řyvind Isaksen | last post: by
6 posts views Thread by scottyman | last post: by
3 posts views Thread by =?Utf-8?B?ZGF2aWQ=?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.