[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

Calling Oracle Function via ADO in VB 6

Asked by DJMikeAZ in Miscellaneous Programming

Tags: function, oracle, call, vb

Using Visual Basic 6.0 and ADO, how can I call Oracle FUNCTIONS (not "procedures") within a package?  I can either use a Microsoft or Oracle ODBC driver, but I cannot use OO4O.

Versions:
Database
-------------
Oracle Version:  9i
(with 8.1.6 driver version)

Workstation
-------------
Oracle ODBC Driver:  8.1.6
Microsoft ODBC Driver:  2.573.9030
VB:  6.0 SP3
ADO:  2.5 - 2.7

No matter what information I've found on this and other forums, I've had no success in formulating the correct ADO call.  With each permutation I try, I seem to get a different error message, so I can't remember which ones I've gotten under which configurations.  The end result is always an error when I call the Execute method on the command object.

Even though I have successfully connected to the database and retrieved data using dynamic SQL ("SELECT * FROM ..."), please include specific examples from connection to the execution of the Oracle function in your answer.

The Oracle functions I'm calling have return values of type INTEGER and varying input parameters.  Here's an example of one:

FUNCTION fnAEOutcomeTypeAdd(
     p_sTypeName IN char)
RETURN INTEGER IS
     nTypeId           ae_outcome_type.ae_outcome_code%TYPE;
     sProcName     ERROR_LOG.PROC_NAME%TYPE  := 'pkgSpxLookups.fnAEOutcomeTypeAdd';
     nProcLocation ERROR_LOG.ERR_LOC_ID%TYPE := 0;
BEGIN
     SAVEPOINT BeginningOfFunction;

     nProcLocation := 1;
     select SEQ_AE_OUTCOME_TYPE.nextval into nTypeId from dual;

     nProcLocation := 2;
     insert into AE_OUTCOME_TYPE ( ae_outcome_code, ae_outcome_name)
          values (nTypeId, p_sTypeName);
     RETURN( nTypeId );

     EXCEPTION
     WHEN OTHERS THEN
          --Log the error
          pkgError.logError(sProcName,
                           nProcLocation,
                           null,
                           'Type Name='||p_sTypeName);
     --Undo the effects of this function when an exception occurs
     ROLLBACK TO BeginningOfFunction;
     RETURN (-1);

END fnAEOutcomeTypeAdd;
[+][-]02/11/03 04:08 PM, ID: 7930076Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Miscellaneous Programming
Tags: function, oracle, call, vb
Sign Up Now!
Solution Provided By: piomice
Participating Experts: 1
Solution Grade: A
 
[+][-]02/11/03 04:11 PM, ID: 7930089Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89