Sequence-less/Trigger-less Oracle Auto Increment

Oracle sucks. Well, not totally, but it fails in a lot of places where MySQL is sexy. One little gem of an irritation is the lack of an auto_increment attribute associated with fields. Instead you have to make use of Oracle Sequences/Triggers which adds a whole layer of complexity on the creation and insertion into a simple table.

I’m not quite sure on this statement’s efficiency, but here’s my solution:

INSERT INTO table (id,name) (SELECT CASE WHEN MAX(id) IS NULL THEN 1 ELSE MAX(id)+1 END, ‘bork’ FROM table);

EDIT: It seems that this isn’t such a good idea, after help from my friendly neighborhood DBA.