Home » SQL & PL/SQL » SQL & PL/SQL » Select Data and Time and Concatenate to one Column
Select Data and Time and Concatenate to one Column [message #426595] Fri, 16 October 2009 15:56 Go to next message
vimana
Messages: 1
Registered: October 2009
Junior Member
Hi,

I'm trying to combine the Date and Time columns into one column with the select statement.
How can I do this?

Format of Date output is:
YYYYMMDD

Format of Time output is
HH24:MI:SS

I want it to be selected as a datetime column with format YYYY-MM-DD HH24:MI:SS

Please let me know if this is possible and how I can do it.

Much thanks!
Re: Select Data and Time and Concatenate to one Column [message #426597 is a reply to message #426595] Fri, 16 October 2009 16:02 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Don't use strings to store dates and times, use a date data-type.

Re: Select Data and Time and Concatenate to one Column [message #426612 is a reply to message #426595] Sat, 17 October 2009 00:55 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
TO_CHAR

regards,
Delna
Re: Select Data and Time and Concatenate to one Column [message #426616 is a reply to message #426595] Sat, 17 October 2009 01:31 Go to previous messageGo to next message
Michel Cadot
Messages: 64111
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Use CONCAT or || to concatenate 2 strings.
Follow ThomasG"s advice.

All SQL functions and operators are described in Database SQL Reference.

Regards
Michel
Re: Select Data and Time and Concatenate to one Column [message #426873 is a reply to message #426597] Tue, 20 October 2009 03:10 Go to previous message
Its_me_ved
Messages: 979
Registered: October 2009
Location: India
Senior Member
ThomasG wrote on Fri, 16 October 2009 16:02
Don't use strings to store dates and times, use a date data-type.



@Vimana: ThomasG sir has put the above statement. You might want to know Why?

Here is the answer

[Updated on: Tue, 20 October 2009 03:44]

Report message to a moderator

Previous Topic: Cursor to fetch first day and last day of the quarter
Next Topic: Page break in pl/sql
Goto Forum:
  


Current Time: Mon Dec 05 21:21:19 CST 2016

Total time taken to generate the page: 0.06651 seconds