Oriol Tomàs said:
I'm working with Visual Basic .Net and Oracle 9i.
I use stored procedures that return ref cursors to query data from my
database.
This isn't a portable solution because ref cursors is a particular Oracle
type.
Do you know a better solution?
Well for SQL Server, stored procedures can "magically" return result sets to
clients, which Oracle stored procedures cannot do. So you've got a dillema.
One option is to never return result sets from stored procedures. Only use
scalar values. If you plan on porting beyond Oracle and Sql Server then
this is your best option. In that case you probably shouldn't use stored
procedures at all.
However if you are just targeting Sql Server and Oracle, then you don't have
to give up this highly usefull feature. The trick is just to establish a
convention where the sql server stored procedure and the Oracle stored
procedure differ only by the presense of a ref cursor output parameter at
the end of the parameter list. Then in your application if you're
retreiving a result set from a stored procedure using ExecuteReader or a
DataAdapter, add an extra ref cursor out parameter to the command at
runtime.
David