oracle 如何用sql生成日曆

2021-09-06 22:42:19 字數 2292 閱讀 6953

bi分析中,經常需要將事實表與時間維度表關聯起來,按年/月/日來逐層展示,常用的做法是建立一張日曆表,結構類似如下:

create

table

t_bas_calendar

( d_year

number(4) not

null

, d_month

number(2) not

null

, d_day

number(2) not

null

);comment

ontable

t_bas_calendar

is'日曆表';

comment

oncolumn

t_bas_calendar.d_year

is'年

';comment

oncolumn

t_bas_calendar.d_month

is'月

';comment

oncolumn

t_bas_calendar.d_day

is'日

';alter

table

t_bas_calendar

addconstraint pk_bas_calendar primary

key (d_year, d_month, d_day);

1

create

orreplace

procedure p_import_calendar(p_year_start number

,2 p_year_end number) is

3 cmonth integer

;4 cyear integer

;5 cday integer

;6 day_first integer

;7 day_last integer;8

begin9--

生成從p_year_start到p_year_end的所有日曆 created by [email protected] 2015-04-27

oracle 如何用sql生成日曆

bi分析中,經常需要將事實表與時間維度表關聯起來,按年 月 日來逐層展示,常用的做法是建立一張日曆表,結構類似如下 create table t bas calendar d year number 4 not null d month number 2 not null d day number ...

oracle 如何用sql生成日曆

bi分析中,經常需要將事實表與時間維度表關聯起來,按年 月 日來逐層展示,常用的做法是建立一張日曆表,結構類似如下 create table t bas calendar d year number 4 not null d month number 2 not null d day number ...

如何用word vb巨集來生成sql

昨天boss下了個命令讓我用word巨集的方式來快速生成sql,這樣在我們建表的時候就不用在一條一條元資料的輸入。從而提高效率節約成本 接到命令後就開始著手來做,一邊上網搜相關的現成的材料,一邊看vb巨集的 教程。終於讓我寫出了這個程式,雖說有點兒小吧,可是感覺挺好的。這裡的vb巨集要針對固定的資料...