RAD Studio |  |

Preparing Stored Procedures
See Also
Collapse All

As with query-type datasets, stored procedure-type datasets must be prepared before they execute the stored procedure. Preparing a stored procedure tells the data access layer and the database server to allocate resources for the stored procedure and to bind parameters. These operations can improve performance.

If you attempt to execute a stored procedure before preparing it, the dataset automatically prepares it for you, and then unprepares it after it executes. If you plan to execute a stored procedure a number of times, it is more efficient to explicitly prepare it by setting the Prepared property to True.

Copy Code

    MyProc.Prepared := True;

Copy Code

    MyProc->Prepared = true;

When you explicitly prepare the dataset, the resources allocated for executing the stored procedure are not freed until you set Prepared to False.

Set the Prepared property to False if you want to ensure that the dataset is re-prepared before it executes (for example, if you change the parameters when using Oracle overloaded procedures).

See Also

Fetching Multiple Result Sets

Executing Stored Procedures that Don't Return a Result Set

Working with Stored Procedure Parameters

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!