Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Flight Date Format

user545194Aug 29 2007 — edited Aug 29 2007
Hi!

This insert statement inserts the flight number, flight date, and capacity into the flights table. However, the flight date is a timestamp data type in Java. I need the date to show only day, month, and year without the time.

INSERT INTO flights
SELECT 'LH6035', TO_DATE('20070101', 'YYYYMMDD') + day -1, 150
FROM days
WHERE ROWNUM <= 365;

-----------------------------------------------------------------------------------------------------------------------

SELECT * FROM flights WHERE ROWNUM <= 2;

FLIGHT_NUM FLIGHT_DATE CAPACITY
--------------------- ---------------------- --------------------
LH6035 01-01-07 150
LH6035 02-01-07 150

The output here is correct, but maybe the translation into Java is wrong?

Thanks for any help!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 26 2007
Added on Aug 29 2007
5 comments
443 views