Top Previous Next

Contains the parameters for a query's SQL statement.


property Params[Index: Word]: TParams;


Access Params at runtime to view and set parameter names, values, and data types dynamically (at design time use the collection editor for the Params property to set parameter information). Params is a zero-based array of TParams parameter records. Index specifies the array element to access.

Instead of usual Delphi parameters representation PostgreSQL one used:

SELECT * FROM "Customers" WHERE "CustID" > $1 AND "CustID" < $2;

TPSQLDirectQuery doesn't parse SQL for automatic parameters creation. This means that developer should manually create needed parameters.


The following code runs an SELECT query to fetch records with primary key greater then 5132.

PSQLDirectQuery1.SQL.Text := 'SELECT * FROM Customer WHERE CustNo > $1';
with PSQLDirectQuery1.Params.CreateParam(ftInteger, '', ptOutput) do
  Value := 5132;
ShowMessage(Format('There is %d rows', [PSQLDirectQuery1.RecordCount]));