Subject | Re: [firebird-support] sql update |
---|---|
Author | Martijn Tonies |
Post date | 2004-02-06T20:50:25Z |
Hi Henrik,
SET COL1 = COALESCE(:inVal1, COL1,
COL2 = ...
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com
> Hi, in a stored procedure I say something like this:Firebird 1.5? Cause then you might want to try something like:
>
> update aTable
> set col1 = :inVal1, col2 = :inVal2, col3 = :inVal3
> where col4 = '...';
>
> inVal1, inVal2, inVal3 and inVal4 are input parameters, and the thing is
> that I just want to update the columns where the input parameters are
> not null. So if inVal1 is null and the other input parameters are not, I
> want to update col2 and col3 but not col1.
>
> Is there a clever way to do this, using some sort of if/case...
SET COL1 = COALESCE(:inVal1, COL1,
COL2 = ...
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com