How to create Generic TIME CLASS, which includes Objects Year,Month and Qtr?Database in use is Oracle.

Showing Answers 1 - 3 of 3 Answers

If your database consist all dates something like 01/02/2000 or 01-Feb-2000, you will need to break the date field into year, qtr,month & if required date.

to do this, create a class named TIME, under that create new object, in it's select box use oracle's date functions to get required information.

For E.g. : to_char(sales_date, 'YYYY') for getting only year from the date.

similarly, for quarter you can use to_char(sales_date, 'Q')

& for month to_char(sales_date, 'MM') for month number, instead of 'MM' if you use 'MON' it will return you abrevations like Jan for January & so on. for full name of month use 'MONTH'

Cheers,

Pat.

  Was this answer useful?  Yes

Adi

  • Jun 9th, 2006
 

Pat,

Do i need to have some tabel selected like u have mention sales_date? 

  Was this answer useful?  Yes

well adi,

it is not a table name, but column name(sales_date).It can be any name depending upon your ETL process & naming convensions. if you have the database ready & you want to break your dates in discussed format, will you process each & every entry from database? certainly not...so simply put a column name ...the column that holds your dates.

you can try the discussed sytax using sysdate (oracle's keyword for current date) 

syntax : to_char(sysdate, 'YYYY') from dual; 

            to_char('01-Jan-2006', ''YYYY') from dual;

where dual is inbuilt table in Oracle.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions