Rob's right but you're making a huge mistake by trying to make an autogenerated number mean something. You need to rethink your strategy before it's too late.
One way to do this would be to use a column in a sequences table which will have the last used number. To get a new number lock the table, select the field, update/increment it, then unlock the table.