CommandBuilder is a very handy class that helps us avoid having to write INSERT,UPDATE and DELETE commands. It does it very easily when CommandType is Text. But when CommandType is StoredProcedure and the pocedure returns a SYS_REFCUSOR it fails to generate the SQL. I try to use sotred procedures to retrieve data from Oracle database. Selection goes easily. (I assign the output paramater – in this case the cursor returned- to a IDataReader). Is this still possible for CommandBuild to generate update SQLs with stored procs returning cursor? Or do I have to write all those SQLs manually. (How I miss MS SQL Server for its being able to return a result with stored procedures.)
CommandBuilder is a very handy class that helps us avoid having to write INSERT,UPDATE
Share
After a long hopeless searches I found the answer to my question from the most authorized source: ORACLE
Here’s what ODP.NET documentation notes:
REF CURSOR types cannot be updated. However, data that is retrieved into a DataSet
can be updated. Therefore, the OracleDataAdapter class requires a custom SQL
statement to flush any REF CURSOR data updates to the database.
The OracleCommandBuilder object cannot be used to generate SQL statements for
REF CURSOR updates
I think that last sentence is just the right answer to my question. Hope this will help somebody.