How do you insert 9 MB file into a Blob Field Using Oracle.DataAccess?

匆匆过客 提交于 2020-01-06 15:38:06

问题


Trying to insert a large audio file into an Oracle 10g database and keep getting this error:

ORA-01460: unimplemented or unreasonable conversion requested

The byte array length of the audio file is 2702577. The procedure works with smaller array lengths, but not the larger ones.

Here is my code and Thanks!

Dim oracleConnection As New OracleClient.OracleConnection
        Dim Cmd As New OracleClient.OracleCommand
        Dim oracleDataAdapter As New OracleDataAdapter

        oracleConnection.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("MasterConnectionODT")
        Cmd.Connection = oracleConnection
        Cmd.CommandText = "Audio.ADD_AUDIO"
        Cmd.CommandType = CommandType.StoredProcedure

        Dim aParam As New OracleClient.OracleParameter
        aParam.ParameterName = "I_FACILITY_ID_C"
        aParam.OracleType = OracleType.Char
        aParam.Value = FacID
        aParam.Direction = ParameterDirection.Input
        Cmd.Parameters.Add(aParam)

        aParam = New OracleParameter
        aParam.ParameterName = "I_TARP_ID_N"
        aParam.OracleType = OracleType.Number
        aParam.Value = TarpID
        aParam.Direction = ParameterDirection.Input
        Cmd.Parameters.Add(aParam)

        aParam = New OracleParameter
        aParam.ParameterName = "I_AUDIO_BLOB"
        aParam.OracleType = OracleType.Blob
        aParam.Value = Audio
        aParam.Direction = ParameterDirection.Input
        Cmd.Parameters.Add(aParam)


        Using oracleConnection
            oracleConnection.Open()
            Cmd.ExecuteNonQuery()
        End Using

回答1:


You can't pass parameters larger than 32k into a stored procedure. Change your command to SQL instead. So it would be something like:

Cmd.CommandText = "insert into yourtable values (:I_FACILITY_ID_C, :I_TARP_ID_N, :I_AUDIO_BLOB)"
Cmd.CommandType = CommandType.Text

If you still have trouble, you try using ODP.Net if you aren't already.



来源:https://stackoverflow.com/questions/2836520/how-do-you-insert-9-mb-file-into-a-blob-field-using-oracle-dataaccess

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!