Updating Oracle Sequences to the Next Highest Unused ID
Be the 1st to comment!

I have six tables that all use one auto incrementing sequence in Oracle. Problem is, every time the database is redeployed, the next value in the sequence is incorrect because it has to be set statically. So I found this sql on the internet which will update your sequence number according to the next unused ID from your table. I modified the sql because my sequence spanned more than one table. So the modified sql uses a temp table to find the next unused id across multiple tables.

It runs only in sqlplus (due to the use of the variables). I run it with this command:
sqlplus user/pass@/path/scriptname

My modified sql.

Original sql.

UPDATE: Thanks to Dan Wilson, Business Analyst where I am currently under contract, for giving me some sql to handle this much better than the sql I had previously found.

SELECT 'DROP SEQUENCE REPORT_LOG_SEQ ; CREATE SEQUENCE REPORT_LOG_SEQ INCREMENT BY 1 START WITH ' || NVL((SELECT TO_CHAR(MAX(LOG_ID)+1) FROM REPORT_LOG),20000) || ' MAXVALUE 1.0E27 MINVALUE 1 NOCYCLE CACHE 20 NOORDER ;' FROM DUAL

This code drops the sequence and then recreates it using the highest id currrently in use in a table, plus one. The only caution about this method, is that, if like my situation, you are using a sequence for multiple tables, then you have to use the table with the highest id in it. So if you are in that situation and you need to automate this process, and you won’t know which table has the highest id, then you may still have to use the previous method I used above. Otherwise, this is much simpler.

Centering with CSS
Be the 1st to comment!

I found this helpful for centering some links today. It could be used to center any block on a web page, both vertically and horizontally.

Bicycles and the Segway
Be the 1st to comment!

Since the Segway first came out, I’ve been one who has believed the Segway will eventually make much more of an impact than most believe today. Tonight, I was reading to my son about the Wright brothers, and just had to share with you some interesting history, that I think is relevant to the Segway and other inventions that many underestimate upon first glance.

Did you know that the first “bicycle” was invented in 1818? It was a two wheeler, moved by pushing with the feet while sitting. Then in 1839, the first pedals were added, but the wheels were still made out of wood or iron, which made for a very uncomfortable ride. In the 1870s, spokes, steering, brakes and chains were added. Finally in 1888 rubber tires were added, and 40,000 bikes were sold in 1890. Five years later, over a million bicycles were being produced.

I’m sure in 1818, not many ever thought that bicycles would become such a common household item. It took over 70 years before the bicycle became what we now know it as.

Coincidentally, we also watched a show tonight about old cars, and they were showing the steam cars and early gas cars. Very interesting to see a steam car as it moved so silently and much faster than I ever would have guessed. And yet, from what I saw on the show, they look to be quite a lot of work to use. Obviously, cars have changed a lot since then, as did bicycles and airplanes.

If you look at the history of most inventions, they follow a similar pattern, usually beginning with the first step looked upon quite skeptically by the masses. But, perhaps now, that you’ve been reminded of the history behind bicycles, maybe you’ll look at the Segway and other inventions with a slightly different point of view.

Now…go invent something! ;)

Java Groovy
Be the 1st to comment!

If you haven’t yet read about Groovy, here is an article on Sun’s web site about it. I like the idea, as you should probably have guessed from my complaints about Java. Just looking at some of the examples reminds me of the fun years I had developing simple things in Perl. No, this won’t replace Java development in general, but it could be used for some very simple applications, from Unix scripts to simple web sites.

Just Because It's Free, Doesn't Mean It's Free
Be the 1st to comment!

Just a thought for Internet Web Development departments. Many times a department will make a decision to use another technology (for example, an open source Java library) which is free. Its quickly implemented, but the department and the company never stop to calculate the true costs. When adding any new technology, there will always be a learning curve, not only for the current employees but also for any new employees brought on in the future (whether out of growth or for replacement). As well, now that an additional skill set, or API knowledge is needed, it might increase what the company has to pay to hire an employee.

The added technology may solve a real problem, and may not cost the department anything up front. But the question is, how much company time and money will it cost down the road? Will it be harder to replace any employees who have this new knowledge? Will other employees in the department need training? How quickly will they be able to pick it up? Will it unnecessarily complicate your application?

All important questions to ask.

Page 26 of 28« First...1020...2425262728