In my work was installed ORACLE 11gR2 in Linux (RHEL5 64 bits)
In one table exist one filed VARCHAR2(8) with filled '20110101' (date string)
I tried execute one SQL Statement to catch an interval in this filed.
But, occurs message error: Literals in the input must be the same length as literals in the format string (with the exception of leading whitespace). If the
"FX" modifier has been toggled on, the literal must match exactly,
with no extra whitespace.
My SQL:
SELECT * FROM SE101
WHERE TO_DATE(E1_VENCTO, 'DD/MM/RR') >= TO_DATE(sysdate, 'DD/MM/RR')
And my NLS_LANGE (select * from v$nls_parameters) is:
NLS_DATE_FORMAT DD/MM/RR
I tryed change my SQL to:
SELECT * FROM SE101
WHERE TO_DATE(E1_VENCTO, 'YYYYMMDD') >= TO_DATE(sysdate, 'YYYYMMDD')
literal does not match format string"
*Cause: Literals in the input must be the same length as literals in
the format string (with the exception of leading whitespace). If the
"FX" modifier has been toggled on, the literal must match exactly,
with no extra whitespace.
*Action: Correct the format string to match the literal.
When I execute using DD/MM/RR (mask) in SELECT clause =
Date: 20110512
Returns: 20/11/12
When I execute using YYYYMMDD (mask) in SELECT clause =
Date: 20110512
Returns: 12/05/11 (right)
But, I use in WHERE clause:
SELECT * FROM SE1010
AND TO_DATE(E1_VENCTO, 'YYYYMMDD') >= sysdate
This error occurs:
01841. 00000 - "(full) year must be between -4713 and +9999, and not be 0"
*Cause: Illegal year entered
*Action: Input year in the specified range
But the year is ok, not exist an invalid year.
Pls, help me ! I need resolve this issue.
I execute this query and works fine:
SELECT * FROM SE1010
WHERE E1_VENCTO = '20110512'
but, when I try this simple query:
SELECT * FROM SE1010
WHERE TO_DATE(E1_VENCTO) = TO_DATE('20110512')
error occurs:
01861. 00000 - "literal does not match format string"
*Cause: Literals in the input must be the same length as literals in
the format string (with the exception of leading whitespace). If the
"FX" modifier has been toggled on, the literal must match exactly,
with no extra whitespace.
*Action: Correct the format string to match the literal.
And I change the format to YYYYMMDD, DDMMYYYY, DDMMRR, RRRRMMDD, RRMMDD and all show me same error.
except MMDDYYYY, this format show me "invalid month" errormessage.
One information, this data was export from SQLSERVER to ORACLE. In SQL Server, the data was VARCHAR in ORACLE VARCHAR but I not sure is the problem.
Bookmarks