Entry
What query I must send to Oracle 8 server to receive list of last 12 months (for example: Jan-99, Feb-99...)?
Apr 13th, 2004 13:18
Rohit Kulkarni, Luiz Paulo Rosa, Mikhail Kashkin,
SELECT *
FROM MyTable
WHERE DateColumn>'19-JUN-01'
will return you all the rows where DateColumn is greater than the date
you gave (in this case '19-JUN-01')
--------------------------------------
In PL/SQL, you could use 'sysdate' to get the current date. So, the
following query would give you the previous month :-
select to_char(sysdate-30, 'Month YYYY') from dual;
You could execute this query in a loop to get all previous 12 months or
add extra columns to the select clause. The column format can be
changed to get the exact time or 3-letter month, etc.