Subject Re: [firebird-support] Re: FB 2.1 - UPDATE OR INSERT
Author Fidel Viegas
On Tue, May 27, 2008 at 12:01 PM, Helen Borrie <helebor@...> wrote:
> At 07:35 PM 27/05/2008, fidel vegas wrote:
>>>
>>> myfield0 is pk here
>>> UPDATE OR INSERT INTO TABLO (myfield0,myfield1)
>>> VALUES (:F0,:F1,:F2,:F3,:F4) MATCHING (myfield0,myfield1)
>>
>>That is the syntax you use inside a stored procedure. You will have to
>>provide values like in a normal insert if you are using the statement
>>in DSQL.
>
> Supplying the values list wholly or partly as constants is an option but
> there is nothing limiting it to this form.
>
> However, the example above isn't valid for *any* usage because the argument
> and values lists don't correspond.
>
> Valid parameterised DSQL syntax for Delphi, which uses colon-prefixed named
> parameters, could be:
> UPDATE OR INSERT INTO TABLO (myfield0,myfield1, afield2, afield3, afield4)
> VALUES (:F0,:F1,:F2,:F3,:F4) MATCHING (myfield0,myfield1)

Oh, I didn't know this was a Delphi syntax.

> The equivalent for some other interfaces would be:
> UPDATE OR INSERT INTO TABLO (myfield0,myfield1, afield2, afield3, afield4)
> VALUES (?,?,?,?,?) MATCHING (myfield0,myfield1)

Yes, that is the one for Java, for instance.

Fidel.