db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: Basic SQL question Update statement
Date Sun, 27 Sep 2009 18:22:26 GMT
bruehlicke <bruehlicke@gmail.com> writes:

> I have a trigger something like
>
> ..... UPDATE X SET A=(SELECT ..... )
>
>
> Now, if the embedded SELECT statement returns no rows I would NOT like
> to change the value from A to "bank/null" but let it keep the value it
> currently has.
>
> Any suggestions for a one liner which fits into a create trigger statement

I think this should do the trick:

UPDATE X SET A=COALESCE((SELECT ......), A)

-- 
Knut Anders

Mime
View raw message