开发者

ODP.NET Pass large byte array to PL/SQL stored procedure accepting blob

开发者 https://www.devze.com 2023-02-24 06:39 出处:网络
I have a PL/SQL stored开发者_StackOverflow社区 procedure accepting a BLOB argument (among other arguments) and executes an insert of the BLOB into a table. How can I pass a large (1MB and greater) byt

I have a PL/SQL stored开发者_StackOverflow社区 procedure accepting a BLOB argument (among other arguments) and executes an insert of the BLOB into a table. How can I pass a large (1MB and greater) byte array from .NET to the stored procedure.


As of Oracle 11.2/ODP.Net v2.112.1.2, you can't pass an array of BLOBs. From Oracle® Data Provider for .NET Developer's Guide 11g Release 2 (11.2.0.3), PL/SQL Associative Array Binding:

...ODP.NET supports binding parameters of PL/SQL Associative Arrays which contain the following data types.

  BINARY_FLOAT
  CHAR
  DATE
  NCHAR
  NUMBER
  NVARCHAR2
  RAW
  ROWID
  UROWID
  VARCHAR2   

Using unsupported data types with associative arrays can cause an ORA-600 error.

Note too: Oracle Forums: Passing Associative Array of BLOBs Not Supported.


When you're setting up your SP query (getting ready to Prepare it) set the the data type of the parameter to OracleDbType.Blob.

OracleParameter p = query.CreateParameter();
p.OracleDbType = OracleDbType.Blob;
p.Direction = ParameterDirection.Input;

Then right before you run the query simply set the parameter's value to the big BLOB you're mentioning.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号