Skip to Content
avatar image
Former Member

How to display last 12 months Data in sap HANA?

Hi guys!!!

I have already done this logic in PLSQL and now I want implement in HA NA.

I am trying to do it but I am getting error. could you please help me out.

please find the PLSQL code below. I am getting syntax problem.


v_yearsum number;


for emprecord in (select *from mydata)


select sum(revenue) into v_yearsum

from mydata

where c_date between add_months(trunc(emprecord.c_date,'month'),-11) and add_months(trunc(emprecord.c_date,'month'),1)-1;

dbms_output.put_line(emprecord.c_month||' '||emprecord.c_date||' '||v_yearsum);

end loop;


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers