Amusing error messages
So far in this blog I have not posted at all about what I do for a living. I've only posted about one of my many hobbies. But today I ran into something I wanted to share. I could go on and on about how I could share it (Facebook, Yammer, emails to hapless co-workers, emails to hapless friends, drone on and on to my wife about it) but I won't. Much.
Instead, I'll post it here. Here where it can quietly sit where few, if any, will see it. But I can always go back and get a chuckle about it.
Anyway, what I do for a living is write software. I am a software engineer. I've created software in a number of different languages: Pascal, COBOL, C++, Visual Basic, Java, C# - probably others I am forgetting - and I've been doing it for over 17 years now. Strange, but true.
This blog is about stuff I make. Software is stuff I make, right? Okay, boring stuff I make - I'll try and keep it to a minimum.
Anyway, I'm currently contracting at a company that uses Oracle (10g?) as it's primary database server. The current task I am working on involves creating a seed script to load some values in a database. Seed scripts are an easy way around creating an intelligent user interface to do the same thing. It's what I typically do when I am told not to spend too much time working on a task.
The seed script will load a series of values into the database representing the types of pages users can hit on a particular site. The goal is to eventually create a report that shows - by company, date, etc. - how many users hit what page and when. The table I am loading is used to identify the page and associate a key with it. What I was trying to do was to update the sequence object in Oracle that creates that key.
The sequence is an object within Oracle that, when you ask it, gives you the next sequential number in a sequence. It also remembers what it last gave out so it can give the next number next time it is asked. It's useful in generating keys which is exactly what I was using it for.
In this company's development environment I had been doing a lot of testing, so the sequence number was abnormally high. I figured I'd reset it to a lower number to make my seed entries show up with same/similar numbers as the other environments. I attempted to run a command that would do this:
ALTER SEQUENCE ThisTable_SEQ START WITH 200;
This is not allowed in Oracle, but instead of telling me that, they decided to be snide about it. Their responds was:
Error report:
SQL Error: ORA-02283: cannot alter starting sequence number
02283. 00000 - "cannot alter starting sequence number"
*Cause: Self-evident.
*Action: Don't alter it.
The cause was self-evident? Don't alter it? Translation: You can't do that. Duh! Stop it.
It seems odd to me when I get answers like this. It seems even odder that they won't allow me to do this when the work-around is so simple:
DROP SEQUENCE ThisTable_SEQ;
CREATE SEQUENCE ThisTable_SEQ MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 200 CACHE 10 ORDER NOCYCLE;
Anyway, posted here mostly for my own amusement. And so my brain can now forget it because it's here in the cloud, forever and ever...
Comments
Post a Comment