![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 4 of 4 total |
![]() |
Wed, Aug 3 2016 11:56 AM | Permanent Link |
Michael Riley ZilchWorks | I'm trying to understand how and why you would use an OUT parameter within a stored procedure. Can someone please give me a good example for using an OUT parameter?
Can you also explain how you access the OUT result in both EDBManager and Delphi? Thanks in advance. Michael Riley GySgt USMC (Retired) www.zilchworks.com |
Wed, Aug 3 2016 12:30 PM | Permanent Link |
Fernando Dias ![]() | Michael,
First the 'how to': - In EDB Manager, the OUT parameters are shown in a window after the execution of the stored procedure. - In PSM/SQL scrips, you can use them the same way you use var parameters in Delphi procedures, after a CALL to the stored procedure - In Delphi code you can get the value of an OUT parameter by using ParamByName method, as if it was an IN parameter Now, why ... To get results from a procedure ![]() For example, in one of my applications I have a stored procedure that runs a series of tests on the database and returns 3 parameters: the number of errors found, the number of automatically fixed errors and the number of error that were not fixed. -- Fernando Dias [Team Elevate] |
Thu, Aug 4 2016 4:43 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | Michael
I have a script (OK not quite the same) which builds a fairly complex query depending on a couple of IN parameters to build an in-memory table which it then goes on to build (using EXECUTE IMMEDIATE). I added an OUT parameter to give me sight of the query that was built to give me a clue as to what was going wrong. Roy Lambert |
Thu, Aug 4 2016 9:40 AM | Permanent Link |
Adam Brett Orixa Systems | Michael
>>Can you also explain how you access the OUT result in both EDBManager and Delphi? A little bit of Delphi code (untested, but more-or-less right I think): var aProc: TEDBStoredProc; aOutParam: Integer; begin aProc:= TEDBStoredProc.Create(self); // aProc.DatabaseName .... //add lines here to set up the proc so it is connected to your database aProc.StoredProcName:= 'SomeName'; //must exist on the database aProc.Prepare; //initializes the proc, so you can reference parameters if aProc.Prepared then begin aProc.ParamByName('aInputParam').asInteger:= 1234; aProc.ExecProc; //runs the procedure aOutParam:= aProc.ParamByName('aOutParam').asInteger; //gets the result back end; end; |
This web page was last updated on Wednesday, August 14, 2024 at 07:31 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |