fm134
asked on
insert date to database
how to write a gava code that insert a system date into oracle daatbase
this is my database table:
CREATE DIMENSION times_dim
LEVEL day IS TIMES.TIME_ID
LEVEL month IS TIMES.CALENDAR_MONTH_DESC
LEVEL quarter IS TIMES.CALENDAR_QUARTER_DES C
LEVEL year IS TIMES.CALENDAR_YEAR
LEVEL fis_week IS TIMES.WEEK_ENDING_DAY
LEVEL fis_month IS TIMES.FISCAL_MONTH_DESC
LEVEL fis_quarter IS TIMES.FISCAL_QUARTER_DESC
LEVEL fis_year IS TIMES.FISCAL_YEAR
HIERARCHY cal_rollup (
day CHILD OF
month CHILD OF
quarter CHILD OF
year
)
HIERARCHY fis_rollup (
day CHILD OF
fis_week CHILD OF
fis_month CHILD OF
fis_quarter CHILD OF
fis_year
);
this is my database table:
CREATE DIMENSION times_dim
LEVEL day IS TIMES.TIME_ID
LEVEL month IS TIMES.CALENDAR_MONTH_DESC
LEVEL quarter IS TIMES.CALENDAR_QUARTER_DES
LEVEL year IS TIMES.CALENDAR_YEAR
LEVEL fis_week IS TIMES.WEEK_ENDING_DAY
LEVEL fis_month IS TIMES.FISCAL_MONTH_DESC
LEVEL fis_quarter IS TIMES.FISCAL_QUARTER_DESC
LEVEL fis_year IS TIMES.FISCAL_YEAR
HIERARCHY cal_rollup (
day CHILD OF
month CHILD OF
quarter CHILD OF
year
)
HIERARCHY fis_rollup (
day CHILD OF
fis_week CHILD OF
fis_month CHILD OF
fis_quarter CHILD OF
fis_year
);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am using oracle 10g
So you can use the Timestamp one
ASKER
hi pkwan
thanks alot for helping me but can u please showme excactly who ti insert it to the database in java. becuase this isthe first time I deal withe dimentions
thanks alot for helping me but can u please showme excactly who ti insert it to the database in java. becuase this isthe first time I deal withe dimentions
ASKER
hi pkwan
thanks alot for helping me but can u please showme excactly who ti insert it to the database in java. becuase this isthe first time I deal withe dimentions
thanks alot for helping me but can u please showme excactly who ti insert it to the database in java. becuase this isthe first time I deal withe dimentions
For Oracle8i or below:
java.sql.Date d = new java.sql.Date();
d.setTime((new java.util.Date()).getTime(
stmt.setDate(x, d);
For Oracle9i or above:
java.sql.Timestamp t = new java.sql.Timestamp((new java.util.Date()).getTime(
stmt.setTimestamp(x, t);