Today a question came in, and Swapnasis provided a nice simple test case, which makes my job so much easier. Here’s a snippet from it
SQL> create table TTT(
2 testid integer not null,
3 value integer not null,
4 time timestamp not null,
5 unique(testid, time)
6 );
Table created.
See line 5 ?
I’ve been working with Oracle for (well…I’d rather not say ) but lets just says “a number of years” dating back to version 6 of the database. But in all of that time, I never knew that you could just write “unique”. I have always done “constraint MY_CONSTRAINT unique (col1, col2)”.
Its probably also the reason I dont mind doing a few AskTom’s like today, ie, on a Saturday morning over breakfast coffee. Its free education
#neverstoplearning
That’s what happens if you don’t read the manuals (and migrate from another platform) – you discover things that aren’t in the manuals without realising that they aren’t in the manuals. (It works back to at least 8i – once you’ve changed the timestamp type.)
It also remains consistent if you get the metadata back (I just tried in 10.2.0.4 dbconsole, create ddl).
But of course, having system-named check and unique constraints isn’t really the bee’s knees, eh?