SP_CREATE_TIME_DIMENSION 自动生成周末日期
来源:互联网 发布:java web项目实例视频 编辑:程序博客网 时间:2024/06/07 07:14
CREATE OR REPLACE PROCEDURE SP_CREATE_TIME_DIMENSION(begin_date in varchar2,
end_date in varchar2) is
/*SP_CREATE_TIME_DIMENSION: 生成时间维数据
begin_date: 起始时间
end_date:结束时间
*/
dDate date;
v_the_date number;
v_the_year varchar2(4);
v_the_quarter varchar2(2);
v_the_month varchar2(10);
v_the_month2 varchar2(2);
v_the_week varchar2(2);
v_the_day varchar2(10);
v_the_day2 varchar2(2);
v_week_day nvarchar2(10);
adddays int;
BEGIN
adddays := 1 ;
dDate := to_date(begin_date,'yyyymmdd');
WHILE (dDate <= to_date(end_date,'yyyymmdd'))
loop
v_the_date := to_number(to_char(dDate,'yyyymmdd'));--key值
v_the_year:= to_char(dDate, 'yyyy');--年
v_the_quarter := to_char(dDate, 'q');--季度
v_the_month:=to_char(dDate, 'mm');--月份(字符型)
v_the_month2:=to_number(to_char(dDate, 'mm'));--月份(数字型)
v_the_day:=to_char(dDate, 'dd');--日(字符型)
v_the_day2:=to_char(dDate, 'dd');
v_the_week:= to_char(dDate,'fmww');--年的第几周
v_week_day := to_char(dDate, 'day'); --星期几
insert into time_dimension(the_date,date_name,the_year,year_name,
the_quarter,quarter_name,the_month,
month_name,the_week,week_name,week_day)
values(v_the_date,v_the_year||'年'||v_the_month2||'月'||v_the_day2||'日',v_the_year,v_the_year||'年',
v_the_year||'Q'||v_the_quarter,v_the_year||'年'||v_the_quarter||'季度',to_number(v_the_year||v_the_month),
v_the_year||'年'||v_the_month2||'月',v_the_week,'第'||v_the_week||'周',
v_week_day);
dDate := dDate + adddays;
END loop;
commit;
end SP_CREATE_TIME_DIMENSION;
end_date in varchar2) is
/*SP_CREATE_TIME_DIMENSION: 生成时间维数据
begin_date: 起始时间
end_date:结束时间
*/
dDate date;
v_the_date number;
v_the_year varchar2(4);
v_the_quarter varchar2(2);
v_the_month varchar2(10);
v_the_month2 varchar2(2);
v_the_week varchar2(2);
v_the_day varchar2(10);
v_the_day2 varchar2(2);
v_week_day nvarchar2(10);
adddays int;
BEGIN
adddays := 1 ;
dDate := to_date(begin_date,'yyyymmdd');
WHILE (dDate <= to_date(end_date,'yyyymmdd'))
loop
v_the_date := to_number(to_char(dDate,'yyyymmdd'));--key值
v_the_year:= to_char(dDate, 'yyyy');--年
v_the_quarter := to_char(dDate, 'q');--季度
v_the_month:=to_char(dDate, 'mm');--月份(字符型)
v_the_month2:=to_number(to_char(dDate, 'mm'));--月份(数字型)
v_the_day:=to_char(dDate, 'dd');--日(字符型)
v_the_day2:=to_char(dDate, 'dd');
v_the_week:= to_char(dDate,'fmww');--年的第几周
v_week_day := to_char(dDate, 'day'); --星期几
insert into time_dimension(the_date,date_name,the_year,year_name,
the_quarter,quarter_name,the_month,
month_name,the_week,week_name,week_day)
values(v_the_date,v_the_year||'年'||v_the_month2||'月'||v_the_day2||'日',v_the_year,v_the_year||'年',
v_the_year||'Q'||v_the_quarter,v_the_year||'年'||v_the_quarter||'季度',to_number(v_the_year||v_the_month),
v_the_year||'年'||v_the_month2||'月',v_the_week,'第'||v_the_week||'周',
v_week_day);
dDate := dDate + adddays;
END loop;
commit;
end SP_CREATE_TIME_DIMENSION;
0 0
- SP_CREATE_TIME_DIMENSION 自动生成周末日期
- Mysql日期列,自动生成当前日期
- 获得周末的日期
- SQL输出周末日期
- 用当前日期格式自动生成编号
- js实现自动生成日期calendar.js
- Android自动生成作者日期注释
- 根据日期自动生成序列编号
- Gradle根据日期自动生成build号
- 将周末日期改为周五
- SQL自动生成日期加数字的序列号
- SQL自动生成日期加数字的序列号
- SQL Server自动生成日期加数字的序列号
- sql server 按照日期自动生成单据编号的函数
- SQL SERVER 根据日期自动生成流水号
- 根据日期自动生成编码系列号的实例
- [转] SQL Server自动生成日期加数字的序列号
- 在新建java文件时自动生成作者和日期
- 中文分词工具的初步使用图解
- iOS常用的一些类库
- eclipse怎么设置字体大小
- JMeter学习 JMeter使用中遇到的问题:Jmeter Debug - "Unrecognized VM option '+HeapDumpOnOutOfMemoryError"
- jQuery总结
- SP_CREATE_TIME_DIMENSION 自动生成周末日期
- Win7_64bit + VS2013 + CUDA7.5 + Opencv2.4.10 成功配置Caffe环境
- android 沉浸式状态栏实现
- 任务总结
- AS中Git与GitHub的使用入门
- [又值奥运季] 2016年里约奥运会--8月10日赛事
- Valid Anagram
- Android入门:Activity四种启动模式
- 利用RunTime解决由NSTimer导致的内存泄漏