I want to select a column which is from datatype "datetime" in Orcale DB in date format.
column
1/31/2006 22:00:00 AM
I tried the following queries and got errors like below
select DATE_FORMAT(column, 'YYYY-MM-DD') as column from table
ORA-00904: "DATE_FORMAT": invalid identifier
select TO_DATE(column, 'YYYY-MM-DD') as column from table
ORA-00918: column ambiguously defined
select TO_DATE(column, 'YYYY-MM-DD') from table
org.apache.avro.SchemaParseException: Illegal character in: to_date(column,'yyyy-mm-dd')
What is the right syntax for this?
Cast(column as DATE)if you want a DATE type for futher date ariphmetic expressions.dateandtimestamp. My guess is that you mean that the column is of typedate. What data type do you want returned? A string "2006-31-01"? Adatewith the time component set to midnight? Something else?mssql-jdbcwhich is the Microsoft SQL Server JDBC driver. But that driver only works to connect to a SQL Server database. It doesn't make sense in combination with theoracletag. If you are using the Oracle database, you aren't using the Microsoft SQL Server JDBC driver to connect. And vice versa. If you are connecting to a SQL Server database, there is adatetimedata type but the answers will be completely different because SQL Server doesn't haveto_charorto_datefunctions.