Dot Net - Dataset - retrieving from sys_refcursor Oracle Package

First, I am not sure if this is really a problem or just an issue with my understanding of some issues. Essentially, I was trying to access an ORACLE STORED PROCEDURE in a PACKAGE. The procedure returns a sys_Refcursor parameter - which simply means, it is weakly typed.

Creating a Table Adapter in VS2010 and making the appropriate references did not go on as I had anticipated. Normally, if you bind a procedure to a TableAdapter, it should generate the column list automatically as well as the parameter list - if any. However, I noticed that this was not the case for the sys_Refcursor type parameter procedure. I actually think - it's got nothing to do with the sys_refcurson type but a problem with the way the procedure name is generated with some funny escape characters. Either way, you can get around this issue following the steps described in this article.

Once you have this situation, the column list is not automatically generated for the Data table, neither is the parameter list generated correctly. You will need to take corrective measures to fix this. Allow the wizard to complete the setup - you are most likely going to get an alert of one form or the other indicating - the system could not access the procedure specified.

Once the wizard is done, click on the PROPERTY window for the table adapter - most likely, the name will be the default which will be tbe procedure name - with the sepecial charaters as well as a postfix - TableAdapter. You should change the default name for the TableAdapter as well as the DataTable - specifically, get rid of the special characters and ensure that the name is not too lengthy. Also, modifiy the command text to reflect the correct procedure name.

The last thing you will need to do is to manually generate the parameter list for the Generate Method type that you are using. Pay special attention to the output parameter which is of type sys_refcursor in Oracle. Set the properties as shown in the image below and you should be good to go.

Comments

Popular posts from this blog

Decompiling Delphi - 3

Decompiling Delphi - 2

Artificial Intelligence, Oxymoron and Natural Intelligence