I saw this question
so I've one doubt regarding this question:
I am getting different result with the same date on the following query.
SELECT TO_CHAR(to_date(sysdate, 'DD-MON-yy'), 'DAY'),
TO_CHAR(to_date(sysdate, 'DD-MON-yyyy'), 'DAY'),
TO_CHAR(to_date(sysdate, 'DD-MON-rr'), 'DAY'),
TO_CHAR(to_date(sysdate, 'DD-MON-rrrr'), 'DAY')
FROM dual;
output as column-wise:
TUESDAY SUNDAY TUESDAY TUESDAY
please help me, Thanks in advance.
EDIT
I wrote a simple procedure which passing date for finding the day given below:
SET serveroutput ON;
CREATE OR REPLACE
PROCEDURE simple_test
(
date_in IN VARCHAR2)
IS
v_date DATE := to_date(date_in,'dd-mon-yyyy');
v_day VARCHAR2(10):=TO_CHAR(v_date,'day');
BEGIN
dbms_output.put_line('the day of given date is '||v_day);
END;
/
EXEC simple_test(sysdate);
anonymous block completed
the day of given date is sunday
EXEC simple_test('01-JAN-2013');
anonymous block completed
the day of given date is tuesday
why does this happened?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…