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

B

Big George

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top