あなたはいくつかの可能性があります。私は仕事に最も適したデータ型を持つことを好みます。時代とともに計算最高DATE、TIMESTAMPおよびINTERVALを使用して行われているので、私はこのようなものを使用したい:あなたがここにINTERVAL DAY TO SECONDデータ型についての詳細を読むことができ
SQL> create table visits
2 (startdate date
3 , starttime_tour interval day(0) to second(0)
4 , starttime_lunch interval day(0) to second(0)
5 , starttime_presentation interval day(0) to second(0)
6 , constraint visits_ck1 check (startdate = trunc(startdate))
7 )
8/
Table created.
を:http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/sql_elements001.htm#SQLRF00207
そしてここにはありますあなたはそれから挿入し、選択する方法例:
SQL> insert into visits
2 values
3 (trunc(sysdate)
4 , to_dsinterval('0 09:00:00')
5 , to_dsinterval('0 12:00:00')
6 , to_dsinterval('0 13:00:00')
7 )
8/
1 row created.
SQL> select startdate
2 , starttime_tour
3 , starttime_lunch
4 , starttime_presentation
5 from visits
6/
STARTDATE STARTTIME_TOUR STARTTIME_LUNCH STARTTIME_PRESENTATI
------------------- -------------------- -------------------- --------------------
17-12-2010 00:00:00 +0 09:00:00 +0 12:00:00 +0 13:00:00
1 row selected.
そして計算は現在、非常に簡単です:
SQL> select startdate
2 , startdate + starttime_tour as tour
3 , startdate + starttime_lunch as lunch
4 , startdate + starttime_presentation as presentation
5 from visits
6/
STARTDATE TOUR LUNCH PRESENTATION
------------------- ------------------- ------------------- -------------------
17-12-2010 00:00:00 17-12-2010 09:00:00 17-12-2010 12:00:00 17-12-2010 13:00:00
1 row selected.
これが役に立ちます。
よろしく、 ロブ。
ありがとうございました! :D優れています。 :-) – Flukey