Subject Re: [ib-support] Oooops i mean Exchange values between Fields in one Update
Author Helen Borrie
At 01:27 PM 26/05/2003 +0200, you wrote:
>sorry i asked in bad language, i mean Exchange values between Fields in one
>Update
>like
>
>tmp=f1
>f1=f2
>f2=tmp
>
>i am ask just for talking

You can't use variables in a DSQL statement, so the most elegant way to
achieve this would be via a stored procedure. You *could* try doing it in
DSQL by a combination of a "spare" dummy column of the same type as f1 and
f2, a re-entrant query and some correlated subqueries, viz.

update atable a
set a.dummy = (select b.f2 from atable b where b.primary_key = a.primary_key),
a.f2 = (select b.f1 from atable b where b.primary_key = a.primary_key),
a.f1 = a.dummy

Even if this works (not guaranteed!), it is pretty ugly and it will be slow.

heLen