Total Answers and Comments: 3
Last Update: April 20, 2007 Asked by: manoj77ku
No best answer available. Please pick the good answer available or submit your answer.
March 31, 2006 05:32:06 #1
Jagadeesh Pithani
RE: How will you populate the time dimension table ? Usage of Procedure(Oracle) is common to Populate Time Dim.
U may have diffrent Hier.chies but still for ecah level accordingly u need to use some date or time format.
Becareful while populating time data in dim table... Ofcource Procedure will take care of everything.....(Taking on input data and output date is important in Procedure)
From
Jagadeesh
Is this answer useful? Yes | No
April 20, 2007 18:36:46 #2
Rohith Yogendra
Member Since: April 2007 Contribution: 2
RE: How will you populate the time dimension table ? Hi this would be the normal SP Code that i use to populate a time dimension, well again it depends on the business requirements to know what level the Grain is required for a time dimension CREATE OR REPLACE PROCEDURE TIMEDIMBUILD (p_start_date IN DATE, p_end_date IN DATE) AS v_full_date DATE; v_day_of_month NUMBER; v_day_of_year NUMBER; v_day_full_name VARCHAR2(30); v_week_number NUMBER; v_week_full_name VARCHAR2(30); v_month_full_name VARCHAR2(10); v_month_number NUMBER; v_calendar_year NUMBER; v_quarter NUMBER; v_key NUMBER; BEGIN DELETE FROM TimeDim; v_full_date := p_start_date; v_key:=1; WHILE v_full_date < p_end_date LOOP BEGIN v_day_of_month := TO_CHAR(p_start_date,'DD'); v_day_of_year := TO_CHAR( p_start_date, 'DDD'); v_day_full_name := UPPER(TO_CHAR(p_start_date,'DAY')); v_week_number := TO_CHAR(p_start_date,'WW'); v_month_full_name := UPPER(TO_CHAR(p_start_date,'MONTH')); v_month_number := TO_CHAR(p_start_date,'MM'); v_calendar_year := TO_CHAR(p_start_date, 'YYYY'); v_quarter := TO_CHAR(p_start_date,'Q'); INSERT INTO TimeDim (TimeKey,FullDateCode, DayOfMonth, DayOfYear ,DayFullName, WeekNumber, MonthFullName ,MonthNumber, Quarter, CalendarYear ) VALUES (v_key,v_full_date, v_day_of_month, v_day_of_year ,v_day_full_name, v_week_number, v_month_full_name ,v_month_number, v_quarter, v_calendar_year ); v_full_date :=v_full_date+1; v_key:=v_key+1; END; END LOOP; END;
Is this answer useful? Yes | No
April 20, 2007 18:41:58 #3
Rohith Yogendra
Member Since: April 2007 Contribution: 2
RE: How will you populate the time dimension table ? CREATE OR REPLACE PROCEDURE TIMEDIMBUILD (p_start_date IN DATE, p_end_date IN DATE) AS v_full_date DATE; v_day_of_month NUMBER; v_day_of_year NUMBER; v_day_full_name VARCHAR2(30); v_week_number NUMBER; v_week_full_name VARCHAR2(30); v_month_full_name VARCHAR2(10); v_month_number NUMBER; v_calendar_year NUMBER; v_quarter NUMBER; v_key NUMBER; BEGIN DELETE FROM TimeDim; v_full_date := p_start_date; v_key:=1; WHILE v_full_date < p_end_date LOOP BEGIN v_day_of_month := TO_CHAR(p_start_date,'DD'); v_day_of_year := TO_CHAR( p_start_date, 'DDD'); v_day_full_name := UPPER(TO_CHAR(p_start_date,'DAY')); v_week_number := TO_CHAR(p_start_date,'WW'); v_month_full_name := UPPER(TO_CHAR(p_start_date,'MONTH')); v_month_number := TO_CHAR(p_start_date,'MM'); v_calendar_year := TO_CHAR(p_start_date, 'YYYY'); v_quarter := TO_CHAR(p_start_date,'Q'); INSERT INTO TimeDim (TimeKey,FullDateCode, DayOfMonth, DayOfYear ,DayFullName, WeekNumber, MonthFullName ,MonthNumber, Quarter, CalendarYear ) VALUES (v_key,v_full_date, v_day_of_month, v_day_of_year ,v_day_full_name, v_week_number, v_month_full_name ,v_month_number, v_quarter, v_calendar_year ); v_full_date :=v_full_date+1; v_key:=v_key+1; END; END LOOP; END;
Is this answer useful? Yes | No
Go To Top