[Lazarus] Returning value from a Firebird (embedded) generator into Lazarus code
Michael Van Canneyt
michael at freepascal.org
Sat Apr 25 19:18:43 CEST 2015
On Sat, 25 Apr 2015, Gabor Boros wrote:
> 2015.04.25. 16:52 keltezéssel, brian írta:
>>
>> Retrieve a value generated by a Firebird generator (in other words, an
>> autoincremented value stored within the database) and get that
>> incremented value into a Pascal variable. The SQL code to increment
>> the value in the Firebird database is
>>
>> SELECT (<generator>,<increment>) FROM RDB$DATABASE;
>>
>> but I'm struggling to find a way to retrieve that incremented value.
>> Simply attaching a data source to the query returns zero rows when the
>> SQL is executed. I'm wondering whether I need to use a dummy table and
>> then use the generator to update a field, then retrieve the data with
>> a separate query.
>
> Hi,
>
> Use RETURNING clause with INSERT or UPDATE is a better solution.
Correct but this is not a solution if you just need the value, without INSERT or UPDATE statement.
Michael.
More information about the Lazarus
mailing list