Saturday, January 2, 2010

ORACLE-Create a Calendar Table

Create a table named X which should include numbers from 0 to 9. Let say vals as the column name.

so;


create table calendar as

select (a.vals + b. vals*10 + c. vals*100 + d. vals*1000 + e. vals*10000 )+

to_date('01.01.1900','dd.mm.yyyy') date from x a, x b, x c, x d, x e

this will create a table from 01.01.1900 to 10^5 days after.

No comments:

Post a Comment