Richiep86
asked on
14 days before loan start date in oracle sql
Hi
I have a field (QINST_VALUE) in my database which holds all sorts:
24/05/2016
Y
1000.00
yy
25/05/2015
23.00
24/05/2015
cghnfgn
National Rail
27/05/2016
300.50
27/05/2015
Y
I am working with the date fields only.
All i am trying to do is find anything 14 days before the QINST_VALUE (as START_OF_LOAN)
but im getting the error:
ORA-01840: input value not long enough for date format
01840. 00000 - "input value not long enough for date format"
*Cause:
*Action:
I have tried converting the date string into a DATE but its not working.
Any ideas?
I have a field (QINST_VALUE) in my database which holds all sorts:
24/05/2016
Y
1000.00
yy
25/05/2015
23.00
24/05/2015
cghnfgn
National Rail
27/05/2016
300.50
27/05/2015
Y
I am working with the date fields only.
All i am trying to do is find anything 14 days before the QINST_VALUE (as START_OF_LOAN)
WHERE QINST_VALUE between sysdate -14 and sysdate
but im getting the error:
ORA-01840: input value not long enough for date format
01840. 00000 - "input value not long enough for date format"
*Cause:
*Action:
I have tried converting the date string into a DATE but its not working.
and QINST_VALUE < TO_CHAR(sysdate - 14, 'dd/mm/yyyy')
Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That should work. The error you are receiving is due to a type implicit type conversion of the character field to a date.
A number of questions arise from your description so far.
>>where QQUES_ID = 'EF0035Q3' will only return dates<<
Does that mean all the QINST_VALUEs would be character strings in the form of 'dd/mm/yyyy'?
Is AUTH_ACTION always upper case?
Is AUTH_ACTION_DATE a true date datatype (with or without a time portion)?
>>QINST_VALUE < TO_CHAR(sysdate - 14, 'dd/mm/yyyy')<<
This could be problematic as it will make comparisons based on ascii values - 18/05/2015 will be less than 25/04/2015 and, conversely, 25/04/2015 will be greater than 18/05/2015.
>>where QQUES_ID = 'EF0035Q3' will only return dates<<
Does that mean all the QINST_VALUEs would be character strings in the form of 'dd/mm/yyyy'?
Is AUTH_ACTION always upper case?
Is AUTH_ACTION_DATE a true date datatype (with or without a time portion)?
>>QINST_VALUE < TO_CHAR(sysdate - 14, 'dd/mm/yyyy')<<
This could be problematic as it will make comparisons based on ascii values - 18/05/2015 will be less than 25/04/2015 and, conversely, 25/04/2015 will be greater than 18/05/2015.
ASKER
Open in new window
where qques_id = 'EF0035Q3' will only return dates... is that ok? Can i now search for 14 days before the loan date?