I need to get the values of the previous quarter.how to do
this?eg: if my cuurent month is may i need to get the datas
of the month jan,feb,march.Can it be done in oracle.I tried
with date function q but for the month jan its not
retriving the previous quarter(oct-dec).how to solve
this.plpz anyone help me?
Answer Posted / aseem k
SCOTT.EMP TABLE WITH HIREDATE AS COLUMN :
select hiredate,
decode (mod(to_number(to_char(hiredate,'mm')) ,
3 ),0,add_months(last_day(hiredate)+1,-6),1,add_months
(last_day(hiredate)+1,-4),2,add_months(last_day(hiredate)
+1,-5)) "first day OF PREVIOUS QUARTER",
decode (mod(to_number(to_char(hiredate,'mm')) ,
3 ),0,add_months(last_day(hiredate),-3),1,add_months
(last_day(hiredate),-1),2,add_months(last_day(hiredate),-
2)) "last day OF PREVIOUS QUARTER"
from emp
REGARDS
ASEEM
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is transport network substrate (tns) in oracle?
What exactly do quotation marks around the table name do?
Query to retrieve record for a many to many relationship ?
How many types of tables supported by oracle?
What is format trigger?
What are temporal data types in oracle?
How to view existing locks on the database?
Please explain compound trigger in oracle?
What is the purpose of tables, private synonyms and public synonyms in Oracle?
interview questions with answer for cts
Explain an extent?
What is oracle database client?
What is set operator oracle?
How to export several tables together?
What is the maximum number of triggers that can be applied to a single table?