开发者

How to Iterate through OracleDbType.RefCursor result set

开发者 https://www.devze.com 2023-03-13 16:20 出处:网络
I am currently a little stuck right now in my implementation of MVC 2 website that gets data from an Oracle Database... Right now I want to Iterate through a RefCursor out parameter and go threw all o

I am currently a little stuck right now in my implementation of MVC 2 website that gets data from an Oracle Database... Right now I want to Iterate through a RefCursor out parameter and go threw all of the results and serialize it into a customized xml string...

Am I missing something about RefCursor? Becau开发者_如何学Cse after doing some resesarch there doesn't seem to be a way to loop throw all the returned Rows and Columns. I know you can get a DataReader from a RefCursor... But DataReader seems to be somewhat confusing. I just want to go through all the rows and columns of the returned data set... I wish the stored proc designer would have just returned the result set instead of placing it into a freaking Ref Cursor. I am sure she had her reasons though.

This question does seem a little bush league and I will continue to research the best way to do this. Thanks for any information that you can give... Also, I am open to doing this in a completely different way. I am not particularly wedded to any one way of looping through the ref cursor.

P.S Looks like I was using the depreciated way in my code. Any idea on how to do it using ODP.Net?


I think this link: http://www.akadia.com/services/ora_return_result_set.html gives the answer you want. You use a dataadapter to 'fill' a datatable with the refcursor result of the function. Then you can iterate over the datatable.

Although looking at it closer I don't see how the author makes an associate between the 'out' refcursor parameter and the table mapping 'emp'.

0

精彩评论

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