On 4/20/2016 2:51 PM, drum.lu...@gmail.com wrote:
1 - The customer can add any value into users.code column
2 - The customer can chose between *add or no**t* add the value on
users.code column
3 - If users.code is null (because the customer's chosen not to add
any value in there), a trigger/function has to do the job.
4 - the function/trigger add the next available value, which the
default is 1000 and it's stored on companies.client_code_increment
why don't you use a SEQUENCE for this?
... DEFAULT nextval('sequencename') ...
initialize the sequence to 1000.
done.
still sounds pretty sketchy.
--
john r pierce, recycling bits in santa cruz