How To Retrieve Typical Resultsets From Oracle Stored Procedures
This article was previously published under Q174981 On This PageSUMMARY
This article shows how to create a Remote Data Object (RDO) project that
returns a typical Resultset from an Oracle stored procedure. This article
builds on the concepts covered in the following Microsoft Knowledge Base
article:
174679 (http://support.microsoft.com/kb/174679/EN-US/)
: How To Retrieve Resultsets from Oracle Stored Procedures
MORE INFORMATION
Microsoft Knowledge Base article 174679 (http://support.microsoft.com/kb/174679/EN-US/) gives an in-depth example of all
the possible ways to return a Resultset from a stored procedure. The
example in this article is a simplified version. Please refer to 174679 (http://support.microsoft.com/kb/174679/EN-US/) if
you want more information about the process.
NOTE: The Resultsets created by the Microsoft ODBC Driver for Oracle v2.0 using Oracle stored procedures are READ ONLY and STATIC. To retrieve a Resultset requires that an Oracle Package be created. The sample project in this article was created in Visual Basic 5.0 and uses RDO to access and manipulate the Resultsets created by the Microsoft ODBC Driver for Oracle version 2.0 or higher. You will need to have this driver to use the Resultsets - from-stored-procedures functionality discussed in this article and KB 174679 (http://support.microsoft.com/kb/174679/EN-US/). (currently, it is the only driver on the market that can return a Resultset from a stored procedure). If you want more information about using RDO 2.0 with Oracle, please see the following article in the Microsoft Knowledge Base: 167225 (http://support.microsoft.com/kb/167225/EN-US/)
: How To Access an Oracle Database Using RDO
This article is in two parts. The first part is a step-by-step procedure for creating the project. The second is a detailed discussion about the interesting parts of the project. Step-by-Step Example
This query is executing the stored procedure "allperson," which is in the package "packperson" (referenced as "packperson.allperson"). There are no input parameters and the procedure is returning three arrays (ssn, fname, and lname), each with 9 or fewer records. As stated in 174679 (http://support.microsoft.com/kb/174679/EN-US/), you must specify the maximum number of rows you will be returning. Please refer to the Microsoft ODBC Driver for Oracle Help File and 174679 (http://support.microsoft.com/kb/174679/EN-US/) for more information on this issue. When you click on the "Get One" button, you see an input box that prompts you for an SSN. Once you input a valid SSN and click OK, this query is executed: The stored procedure, packperson.oneperson, uses a single input parameter as the selection criteria for the Resultset it creates. Just like packperson.allperson, the Resultset is constructed using the table types defined in packperson. (See 174679 (http://support.microsoft.com/kb/174679/EN-US/) for more information.) NOTE: You can only define input parameters for Oracle stored procedures that return a Resultset. You cannot define output parameters for these stored procedures. These two stored procedures cover the basic uses of stored procedures that return Resultsets. The first one gives you a predefined set of records (such as everyone) and the second will gives you a set of records (or just one record) based on one or more input parameters. Once you have these Resultsets, you can do inserts, updates, and deletes either through stored procedures or SQL that you create on the client. REFERENCES
Microsoft ODBC Driver for Oracle Help File
Oracle PL/SQL Programming by Steven Feuerstein Hitchhiker's Guide to Visual Basic & SQL Server by William Vaughn For additional information, please see the following article in the Microsoft Knowledge Base: 174679 (http://support.microsoft.com/kb/174679/EN-US/)
: How To Retrieve Resultsets from Oracle Stored Procedures
167225 (http://support.microsoft.com/kb/167225/EN-US/) : How To Access an Oracle Database Using RDO 175018 (http://support.microsoft.com/kb/175018/EN-US/) : How To Acquire and Install the Microsoft Oracle ODBC Driver APPLIES TO
| Article Translations
|
Back to the top
