Subject RE: [firebird-support] Two newbie questions
Author Alan McDonald
> 1. How do you do a 'select 50 * 100'. Firebird seems to require a 'from'
> clause. Is there some standard one row dummy table to use for
> this purpose?
> I want to do an insert on a table that has a generator and I need to get
> the generated value back. I was going to do a 'select gen_id(some_gen, 1)'
> and then do the insert with the value that was returned. I suppose I could
> just immediately do a select on the row that was inserted but
> that seems to
> be more trouble than it needs to be.

SELECT gen_id(some_gen, 1) FROM RDB$DATABASE

>
> 2. I would like to do a 'CONSTRAINT SOME_CONSTRAINT CHECK (x = (SELECT
> z.ID FROM Z z WHERE z.OTHER_ID = y))' where x and y are columns from the
> row being inserted. Basically x and y have a 1..* relationship in a
> different table (Z) and I want to make sure that is enforced when
> adding to
> the table in question.I believe that I will have to use an insert trigger
> for this check instead.
>

Yes, a trigger should be used for this

> Frank
>
>
Alan
>