This is no good if you have concurrent sessions both inserting into the same table. You have no way of knowing that in between when process A inserted into the table and when process A checked the last value of the sequence, that process B hadn't inserted a row and caused the sequence to jump.
The way to handle this is to catch the sequence value that was actually used by the trigger, atomically as part of the insert statement itself. Oracle DOES IN FACT provide a way of doing PRECISELY THAT. You can write an insert statement like "insert into foo ... returning id into ?", and then use in/out binding (see DBI docs for bind_param_inout) to catch the value that is spit out into that trailing bind value.
This method works, reliably. It is easy enough. None of the other methods in this thread do work reliably.
Not an editor command: Wq