Reputation: 171
I am new to oracle. I have the following code:
convert(varchar,convert(datetime,p.portfolio_date),112)
How can I achieve the same in oracle?
EDIT:
I have the below code but it is failing:
SELECT to_char(convert(datetime,p.portfolio_date),112)
Upvotes: 0
Views: 64
Reputation: 1222
In Oracle we use TO_CHAR
function to convert datetime type to character type. SQL Server style 112 is YYYYMMDD which can be converted to Oracle syntax this way:
SELECT TO_CHAR(datetime_column,'YYYYMMDD') FROM table;
Upvotes: 3