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
Explain the use of Merge statement in oracle 11g
Name the three major set of files on disk that compose a database in Oracle?
How to define a sub function?
What do you mean by redo log file mirroring?
Explain the use of indexes option in imp command.
Explain an index segment?
How to call a stored function with parameters?
Typically, where is the conventional directory structure chosen for Oracle binaries to reside?
What is a package ? What are the advantages of package ?
What are the ways tablespaces can be managed and how do they differ?
How to compare dates in oracle sql?
Is oracle a relational database?
Explain the use of analyse option in exp command.
What are operators in oracle?
Does facebook use oracle?