Print Thread
GetParameter C++
#763 08/15/00 08:03 PM
Joined: Aug 2000
Posts: 3
C
Member
OP Offline
Member
C
Joined: Aug 2000
Posts: 3
I have a PL/SQL procedure named p_AddCustomer inside a package named AddCustomerPackage.
It has three parameters: cust_id OUT, cust_name IN, cust_info IN. The cust_id value is a sequence using NEXTVAL.
This procedure works, and can be called successfully either from SQL Plus or from a
TOraclePackage component. (It is successful in that the record is written, the
sequence updates, and the proper fields are filled out with the proper values.)
The problem is, I can't get the cust_id back from GetParameter - the parameter doesn't update, it remains the value it was initialized.

C++ doesn't have any par-constants that I'm aware of, so I can't quite copy the example in the docs. What do I try next?
(I've tried with both positional and named parameters - changing the property in the
component each time - and get the same result either way)

here's the code:

int gCustID = 0;
Variant var[3] = {gCustID,passCustName,passCustInfo};
AddCustomerPackage->CallProcedure("p_AddCustomer",var,2);
gCustID = AddCustomerPackage->GetParameter(0);

Is GetParameter supposed to work on the procedure just called? If not, how do you
completely specify what procedure you are calling it on? (the package might
contain several procedures...)

TIA

Re: GetParameter C++
#764 08/16/00 07:21 PM
Joined: Aug 1999
Posts: 22,206
Member
Offline
Member
Joined: Aug 1999
Posts: 22,206
The parInteger constant should also be known in C++. It is declared in the Oracle unit.

In any case, your code should work just fine. The gCustID is an int variable, and if the procedure does assign a value to the output parameter, then the GetParameter function should give you the new value. You can set the Debug property of the TOraclePackage component to True to find out what code is fired.

In 3.4 you will be able to generate a class for this package through the Package Wizard, so that you can simply call this packaged procedure like any other C++ function.

------------------
Marco Kalter
Allround Automations


Marco Kalter
Allround Automations
Re: GetParameter C++
#765 08/17/00 12:27 AM
Joined: Aug 2000
Posts: 3
C
Member
OP Offline
Member
C
Joined: Aug 2000
Posts: 3
Thank You!
I didn't realize that NEXTVAL wasn't being assigned to the parameter. Now that we're doing the assignment specifically, GetParameter is returning it just fine. The debug feature is cool. Thanks again!


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.050s Queries: 14 (0.009s) Memory: 2.5030 MB (Peak: 3.0393 MB) Data Comp: Off Server Time: 2024-05-01 00:46:08 UTC
Valid HTML 5 and Valid CSS