Skip to main content
2 of 2
deleted 338 characters in body
Baxter
  • 295
  • 1
  • 3
  • 10

Hmm, the docs seem to say that:

All requests are delimited by the trigger, class method, Web Service, Visualforce page or anonymous block that executes the Apex code. If the entire request completes successfully, all changes are committed to the database.

So for certain definitions of delimited by...class method a single method that inserts against a utility table containing just an autonumber name that is then deleted at the end of the method before returning its name value should provide you with a valid numeric nickname with zero rows used at the cost of 3 DML operations: one insert, one query and one delete.

Alternatively you could schedule apex job at crazy o'clock that deletes all save one max(name) row, saving you one Delete DML statement.

If you wanted to get crazy about it.

Baxter
  • 295
  • 1
  • 3
  • 10