Subject Re: [Firebird-Architect] Exec. statement parameters
Author Adriano dos Santos Fernandes
Alex Peshkov escreveu:
> On Tuesday 11 December 2007 03:17, Adriano dos Santos Fernandes wrote:
>
>> Unnamed parameters is easier to write. Thanks to TYPE OF COLUMN, current
>> EXECUTE BLOCK syntax may be less tedious, as one doesn't need to know
>> columns types to replicate in the parameters type.
>>
>> And unnamed parameters may also look like named ones, if you put it
>> after variable declaration.
>>
>
> In some other cases when named parameters are very useful. Old well known
> example. One write SQL request in Delphi:
>
> select :param, p.* from Proc(:param) p
>
> and gets very surprised, why database server does not understand what is a
> type of param. Why it understands 'select * from Proc(:param)' but not an
> original operator. It takes time for people to understand that actually
>
> select ?, p.* from Proc(?) p
>
> was written, and this 2 '?' are not related from server's POV. And use of
> named parameters in DSQL API solves such problems.
Yes, this is good. And my arguments is that something like following
code should be allowed:
execute block
as
begin
insert into t values (:p, :p);
end

instead of:
execute block (p integer = :p)
as
begin
insert into t values (:p, :p);
end

and also that named parameters (of exec. stmt) should be care to not
cause future problems like:
execute block (p1 integer = :p2, p2 integer = :p1)
as
begin
insert into t values (:p1, :p2);
end


Adriano