Subject | Re: [firebird-support] Re: FB 2.1 - UPDATE OR INSERT |
---|---|
Author | Helen Borrie |
Post date | 2008-05-27T11:01:35Z |
At 07:35 PM 27/05/2008, fidel vegas wrote:
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)
The equivalent for some other interfaces would be:
UPDATE OR INSERT INTO TABLO (myfield0,myfield1, afield2, afield3, afield4) VALUES (?,?,?,?,?) MATCHING (myfield0,myfield1)
./heLen
>>Supplying the values list wholly or partly as constants is an option but there is nothing limiting it to this form.
>> 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.
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)
The equivalent for some other interfaces would be:
UPDATE OR INSERT INTO TABLO (myfield0,myfield1, afield2, afield3, afield4) VALUES (?,?,?,?,?) MATCHING (myfield0,myfield1)
./heLen