Just beware of using "dates" the way you do:
Code:
where Trans_date between '01-Jan-2004' and '09-Oct-2008'
because 01-Jan-2004 looks like a date to you or me, but - as far as Oracle is concerned - it is just a character STRING (
not a date).
The fact that your query runs well means nothing but that you have used format which is set to be a default date format on your database. For example, it would not run on my database:
Code:
SQL> select * from emp
2 where hiredate between '01-jan-2004' and '09-oct-2008';
where hiredate between '01-jan-2004' and '09-oct-2008'
*
ERROR at line 2:
ORA-01858: a non-numeric character was found where a numeric was expected
SQL>
Therefore, you'd rather use the TO_DATE function and take control over dates. This is one of acceptable solutions:
Code:
... where trans_date between to_date('01.01.2004', 'dd.mm.yyyy')
and to_date('09.10.2008', 'dd.mm.yyyy')