"P Kishor" wrote,
On 2/13/07, jose isaias cabrera <[EMAIL PROTECTED]> wrote:
Greetings!
I would like to be able to update certain columns based on their value.
I
was looking at "ON CONFLICT", but I could not understand it nor I could
not
find any examples quickly, so I say, "heck, that's what the list is
for..."
:-)
What I would like is to do something like this,
UPDATE table SET
ID = '88' if not = '88',
parent = '1171291314642' if null,
children = '',
login = 'blah',
notes = 'blah-blah' if null,
status = 'o'
WHERE ProjID = '88';
Well, if you
UPDATE table
SET ID = '88'
WHERE ProjID = '88'
it will set it to 88 whether or not it is 88. Problem solved. Also
UPDATE table
SET parent = '1171291314642'
WHERE ProjID = '88' AND parent IS NULL
will do the appropriate thing only if parent is null. Else, it will
leave it alone. In any case, WHERE clause is the correct place to put
your constraints, not the SET clause, unless you write functions that
return the desired value to be SET.
So, there is on way of doing it in one call/instruction as I previously
exampled, correct? I will have to do them in many calls, correct?
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------