开发者

What is Oracle RefCursor type equavalent in System.Data.DbType enum in C#?

开发者 https://www.devze.com 2023-04-05 08:00 出处:网络
I\'m programming a DataAccess code using Microsoft Enterprise Library, and I\'m connecting to Oracle Database. When I try to call a Stored Procedure which expecting an out parameter of type RefCursor

I'm programming a DataAccess code using Microsoft Enterprise Library, and I'm connecting to Oracle Database. When I try to call a Stored Procedure which expecting an out parameter of type RefCursor I can't pass it this type since the only available types are these types in "System.Data.DbType". So which type should I pickup for Oracle "Ref开发者_高级运维Cursor" DbType?


Put a null placeholder: http://tiredblogger.wordpress.com/2007/08/27/enterprise-library-and-oracle-stored-procedure-record-sets/

You have to use a parameter array list, you cannot use the AddParameter.


As I remembered, you can name your sys_refcursor "cur_OUT" in Oracle PLSQL side, and just use cmd.ExecutorReader() to retrieve the result on C# side, even without declare the cur_OUT parameter on Enterprise Library Data Access block side.

Here's doc (I forgot where the source is...):

This means that you can name your reference cursor as "cur_OUT" and the Data Access Application Block will bind it for you; you do not need to explicitly create an output parameter for the cursor. If your stored procedures use a cursor with a name other than "cur_OUT," you must explicitly add a parameter for each cursor to the command. Similarly, if your stored procedure contains multiple cursors, you must explicitly add each cursor parameter to the command.

0

精彩评论

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

关注公众号