Subject Re: [firebird-support] Generator problem
Author Svein Erling Tysvaer
> I am using FireBird Data base. when i use the following query
> select gen_id(TIMER_GENERATOR,1) from timer_details;
> Here the sequence name is: TIMER_GENERATOR. schema name is:
> timer_details

This will return one value (row) for every record in TIMER_DETAILS.

> when i execute above query i am getting the
> java.sql.SQLException: Error: executeQueryForObject returned too many
> results.
> when i execute the same query at the command prompt it works fine.

Presumably you used some object that outputs maximum one row, i.e. an
object that is normally used for DSQL and not cursors?

If you want only one value returned, you could use

select gen_id(TIMER_GENERATOR,1) from rdb$database;

rdb$database is a table that exists in every Firebird database and that
table always contains only one record.

HTH,
Set