Executing Stored Procedures That Don't Return a Result Set
Go Up to Understanding Datasets Index
When a stored procedure returns a cursor, you execute it the same way you populate any dataset with records: by setting Active to True or calling the Open method.
However, often stored procedures do not return any data, or only return results in output parameters. You can execute a stored procedure that does not return a result set by calling ExecProc. After executing the stored procedure, you can use the ParamByName method to read the value of the result parameter or of any output parameters:
MyStoredProcedure.ExecProc; { does not return a result set }
Edit1.Text := MyStoredProcedure.ParamByName('OUTVAR').AsString;
MyStoredProcedure->ExecProc(); // Does not return a result set
Edit1->Text = MyStoredProcedure->ParamByName("OUTVAR")->AsString;
Note: TADOStoredProc does not have a ParamByName method. To obtain output parameter values when using ADO, access parameter objects using the Parameters property.
Tip: If you are executing the procedure multiple times, it is a good idea to set the Prepared property to True.