Home » SQL & PL/SQL » SQL & PL/SQL » Generate a report using PL/SQL  () 1 Vote
Generate a report using PL/SQL [message #225470] Tue, 20 March 2007 00:51 Go to next message
dr46014
Messages: 48
Registered: February 2007
Member
Hi
I have 5 yrs of data in my table.The name of my table is transaction.I want to view this data as per the quarters of each year.Means the data will be displayed if we pass year number and quarter as parameter.Quarters are defined as Q1,Q2,Q3,Q4.
I want to view all data if the transaction data is in Q1 or Q2 ...
Means the script will ask
Year:
Quarter:

Laughing


Re: Generate a report using PL/SQL [message #225493 is a reply to message #225470] Tue, 20 March 2007 02:05 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
select ...
where trunc(transaction_date,'Q')
      =
      trunc(to_date(:year || 
                      decode(:q,'Q1','01','Q2','04','Q3','07','Q4','10'),
                    'YYYYMM'),
            'Q')

Regards
Michel

Previous Topic: Insufficient privs to create sequence from procedure
Next Topic: New Row in Table
Goto Forum:
  


Current Time: Sun Dec 04 04:47:48 CST 2016

Total time taken to generate the page: 0.10470 seconds