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.
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to