Subject Re: [Firebird-Architect] Re: Indexed Views
Author Vlad Horsun
> > > R> BTW, may I fill next RFC: "Implement INSERT INTO ... VALUES ...
> > > R> RETURNS ..." that would also return some inserted values (useful for
> > > R> INSERT statements that contain gen_id() calls).
>
> AFAIU, we will already have this this FB 2.0:
>
> EXECUTE BLOCK (a INTEGER, b VARCHAR(10)) RETURNS (id INTEGER) AS
> BEGIN
> id = gen_id(my_generator, 1);
> INSERT INTO my_table (col_id, col_a, col_b) VALUES (:id, :a, :b)

SUSPEND;

!!! ;)

> END
>
> This is, in my opinion, far more powerful and orthogonal solution.
>
> > > ...and DEFAULTs as well. I'm with you 100% on this one.
> > > More useful than the SP stuff... ;->
> ... and it even includes defaults, as in
> EXECUTE BLOCK (a INTEGER = 10, b VARCHAR(10) = 'abc')

No, EXECUTE BLOCK don't have default parameters, but stored
procedures have it.

If you need default parameters with EXECUTE BLOCK just use
variables, i.e.

EXECUTE BLOCK
AS
declare a INTEGER = 10;
declare b VARCHAR(10) = 'abc';
...

Regards,
Vlad