Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Easily Learn To Work With Oracle Stored Procedures In Delphi On Windows With This Sample App

Location

You can find the OraclStoredProc sample project at:

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

  1. Navigate to the location given above and open Ora_StoredProc.dproj.
  2. Press F9 or choose Run > Run.
  3. Click on the Use Connection Definition combo box and select an option.

Files

File in DelphiContains
Ora_StoredProc.dproj
Ora_StoredProc.dpr
The project itself.
fOra_StoredProc.pas
fOra_StoredProc.fmx
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:

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

For the original post please refer to the link below:

http://docwiki.embarcadero.com/CodeExamples/Sydney/en/FireDAC.OraclStoredProc_Sample

Exit mobile version