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?

Answers were Sorted based on User's Feedback



I need to get the values of the previous quarter.how to do this?eg: if my cuurent month is may i n..

Answer / 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

I need to get the values of the previous quarter.how to do this?eg: if my cuurent month is may i n..

Answer / jas

yes its possible...u can use the date functions
select * from table_name where col_name
between add_months (trunc(sysdate,'MONTH')-3)
and trunc(sysdate,'MONTH')-1

try usgin this might help..

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More Oracle General Interview Questions

What is index-organized table in Oracle?

0 Answers   MCN Solutions,


What the is the diff between local index and global index. give some example.

0 Answers   TCS,


What is concurrency in oracle?

0 Answers  


what is integrity constrains?

3 Answers  


How to define an external table with a text file?

0 Answers  






What is oracle update statement with inner join ?

0 Answers  


What are the differences between char and nchar in oracle?

0 Answers  


how to find the second highest salary in a given table????

5 Answers  


What operating systems are supported by oracle database 10g xe?

0 Answers  


What are the components of Logical database structure of ORACLE database?

4 Answers  


How to drop a stored procedure in oracle?

0 Answers  


Please send me Informatica 8.1 certification dumps, my mail id mona85gupta@gmail.com

0 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1789)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)