问题
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