Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time

Status
Not open for further replies.

andypara

Programmer
Apr 25, 2002
32
GB
Does anyone know how you can select the current date AND time from DUAL?

I know SELECT SYSDATE FROM DUAL returns the date, but not the time.

I need to write PL/SQL code that automatically inserts the exact time a record is created, into on of the fields.

Cheers.
 
Oracle type DATE contains both date and time information. If you do not see the time part in sql*plus or some other application, this is only due to formating, that truncates (does not display) the time part. To see the time part in sql*plus you may

alter session set nls_date_format='dd.mm.rr hh24:mi:ss';

or use explicit to_char() conversion.

If you target field is of DATE type , the correct information will be saved, though if it's of some other type - the information may be lost.
 
hi

select to_char(sysdate,'DAY fmDDth MON YYYY HH:MM:SS') as Today from dual;

VGG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top