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 !
Riddhi ValechaPosted Feb 24, 2015, 8:04 AM
I got an error -
ORA-01821: date format not recognized
Manish Kumar ChoudharyPosted Feb 24, 2015, 7:16 AM
Riddhi ValechaPosted Feb 24, 2015, 7:10 AM
Create or Replace Function My_Date_Function
(
IN_NUMBER VARCHAR2
)
RETURN VARCHAR2
AS
P_GROUP VARCHAR2(5000);
BEGIN
RETURN P_GROUP;
ENDMy_Date_Function;
/
------------------
But, I am getting - 0 rows fetched when I run the query.
Manish Kumar ChoudharyPosted Feb 24, 2015, 6:01 AM
Riddhi ValechaPosted Feb 24, 2015, 5:49 AM
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 ChoudharyPosted Feb 24, 2015, 5:15 AM
Go through following link it will help you
http://www.sqlusa.com/bestpractices/datetimeconversion/