Monday, 8 December 2008

A query which generates a sequence in Oracle

Sometimes for some reason, you may need a query in Oracle
which can generate a sequence of numbers or dates.
I found the following to be an elegant way of doing it:

--count from 1 to 10
SELECT rownum
FROM dual
CONNECT BY LEVEL <= 10

--even numbers from from 2 to 20
SELECT rownum*2
FROM dual
CONNECT BY LEVEL <= 10

--get the previous 100 days
SELECT trunc(sysdate) - rownum day
FROM dual
CONNECT BY LEVEL <= 100

Thursday, 4 December 2008

Whoohoo, I'm a hero today!

In order to answer somebody's question today,
I figured out how to use bzr replay
this made me his hero for a day,
and this in turn has made *my* day!

https://answers.edge.launchpad.net/bzr/+question/53349
Markus Korn confirmed that the question is solved:
Thanks a lot Marius, this initial commit did the trick,
you are my hero of the day ;)

Wednesday, 3 December 2008

oracle XE sessions and processes

I found that my locally installed Oracle XE runs out of available connections far too soon for a php app I'm running. This results in some weird gui behaviour: some frames just don't load. Fortunately I found a way to sort of makes it a little better:

sqlplus system@XE
show parameters sessions;
alter system set sessions=250
scope=spfile;
show parameters processes;
alter system set processes=200
scope=spfile;
sudo /etc/init.d/oracle-xe restart

http://www.markcallen.com/oracle/oracle-xe-tuning