sql - Update column value by 1 in Oracle table conditionally -
i have oracle table 4 columns (name, phone, email, count)
if user updating value of 'name' column need increment count column value 1.
if user updating values other column no need increment count column value 1.
initially, when record inserted, count should 0. , every time when 'name' column updated, count should increment 1 (like 1, 2, 3 .....)
how can achieve this, new database
thanks lot help.
you can in update , insert trigger or in program. later requires possible programs cooperate. former (triggers) black art.
a program can this:
update person set count=count+1, phone='123' name=`csr` , phone <> '123';
this update 1 or no record (i.e. if phone 123 nothing).
btw: there no nice solution insert if missing.
hmm, changed question, updating name problematic if not have primary key, want?
Comments
Post a Comment