I have a table like -
| ID | Number | Date1 | Date2 |
| 1 | 1234 | 1/27/2015 4:24:43 PM | 1/27/2015 4:43:43 PM |
| 2 | 1234 | 1/27/2015 4:24:43 PM | 1/27/2015 4:43:43 PM |
| 3 | 7894 | 1/27/2015 4:43:43 PM | 1/27/2015 4:43:43 PM |
| 4 | 9080 | 1/27/2015 4:43:43 PM | 1/27/2015 4:43:43 PM |
I have to make 2 functions -
1. Function - Return Date
IN_NUMBER varchar2
Query = select Date1 (in dd-mmm-yyyy) format where Number = IN_NUMBER
--------------
My Issue -
How do I get dates such that the time part is eliminated ?? I just want "27-JAN-2015" format for date columns.
-----
If I run the function using dual table, it says - 0 rows returned. But, the table has values.
Please help !

Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Feb 24, 2015, 12:15 AM EST
Go through following link it will help you
http://www.sqlusa.com/bestpractices/datetimeconversion/
Riddhi ValechaRank #794 · 2.9K reputationPosted Feb 24, 2015, 12:49 AM EST
I have to make this in TOAD (Oralce).
The Columns have datatype - DATE.
I have to keep VARCHAR2 as datatype of the function.
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Feb 24, 2015, 1:01 AM EST
Riddhi ValechaRank #794 · 2.9K reputationPosted Feb 24, 2015, 2:10 AM EST
Create or Replace Function My_Date_Function
(
IN_NUMBER VARCHAR2
)
RETURN VARCHAR2
AS
P_GROUP VARCHAR2(5000);
BEGIN
ENDMy_Date_Function;
/
------------------
But, I am getting - 0 rows fetched when I run the query.
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Feb 24, 2015, 2:16 AM EST
try this select to_char(Date1, 'dd-mmm-yyyy') into p_Group from table1Riddhi ValechaRank #794 · 2.9K reputationPosted Feb 24, 2015, 3:04 AM EST
I got an error -
ORA-01821: date format not recognized