FireDAC.OraclStoredProc Sample
This sample demonstrates how to work with Oracle stored procedures.
Contents
Location
You can find the OraclStoredProc sample project at:
- Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to:
Object Pascal\Database\FireDAC\Samples\DApt Layer\Oracl_StoredProc
- Subversion Repository:
- You can find Delphi code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.
Description
The OraclStoredProc sample shows you how to work with Oracle stored procedures.
- Note: This demo requires Oracle Demo connection definition. See Demo Databases.
How to Use the Sample
- Navigate to the location given above and open
Ora_StoredProc.dproj
. - Press F9 or choose Run > Run.
- Click on the Use Connection Definition combo box and select an option.
Files
File in Delphi | Contains |
---|---|
|
The project itself. |
|
The main form. |
Implementation
The sample implements the following features.
Create table adapter
var
oAdapt: IFDDAptTableAdapter;
// ...
begin
// create table adapter
FDCreateInterface(IFDDAptTableAdapter, oAdapt);
Assign command
var
oComm: IFDPhysCommand;
// ...
begin
// ...
with oAdapt do begin
FConnIntf.CreateCommand(oComm);
SelectCommand := oComm;
Set the DatSTable name
To set the DatSTable name where the rows are fetched, type the following:
DatSTableName := 'StoredProc';
Set up the SelectCommand property
The SelectCommand property is set up by setting the following properties:
- BaseObjectName to set the package name.
- CommandText to set the procedure name.
- Command Kind to set the kind of content of the CommandText property. It is set to stored procedure with cursor.
Once the parameters are set up, the sample calls the Prepare method.
with SelectCommand do begin
// set package name
BaseObjectName := 'FDQA_testpack';
// set porcedure's name
CommandText := 'SelectShippers';
// we have stored procedure with cursor
CommandKind := skStoredProcWithCrs;
Prepare;
end;
Fetch rows
Define;
Fetch;
Uses
- FDCreateInterface
- IFDPhysCommand
- IFDPhysConnection
- Prepare
- The sample also uses some methods such as Define or Fetch of the following units:
- FireDAC.DApt.Intf
- FireDAC.DApt
See Also
- FireDAC
- FireDAC Data Adapter [DApt]
- Demo Databases (FireDAC)
- Using Stored Procedure-type Datasets
- Executing Stored Procedures (FireDAC)
- Connect to Oracle Server (FireDAC)
- Using Oracle with FireDAC
Samples
- FireDAC DAptLayer GettingStarted sample
- FireDAC DApt Layer Commands sample
- FireDAC Mapping Columns sample