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
How does oracle handle read consistency?
How do I call oracle stored procedures that take no parameters?
What is recovery manager(rman) backup in Oracle?
What is a initialization parameter file in oracle?
Which is better Oracle or MS SQL? Why?
What is oracle in java?
What are the database administrators utilities available?
How does Oracle guarantee data integrity of data changes?
Is it possible to center an object horizontally in a repeating frame that has a variable horizontal size ?
Who developed oracle & when?
Explain the truncate in oracle?
What happens to the indexes if a table is recovered?
What is tns name?
What is tns entry?
How to define a record variable to store a table row?