• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 887
  • Last Modified:

What is oracle's equivalent of datetime. I'm on a 9i database

I'm converting a stored procedure from mssql to oracle, and at the end of the sp, I have....

order by convert(datetime, i.CREATED_DATE) desc;

Oracle does not like datetime.

What's the most simple thing I can do?
2 Solutions
Guy Hengel [angelIII / a3]Billing EngineerCommented:
you want this (fill in the format you really have in the varchar field)
order by TO_CHAR(i.CREATED_DATE, 'yyyy-mm-dd') desc;

Open in new window

date and timestamp are the types you would use in oracle.

if created_date is one of those you don't need to convert it to sort by it.

if it's a string you need to use

to_date(create_date,'mm-dd-yyyy hh24:mi:ss')   --change the format to whatever format your string is in

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now