Skip to Content
0

How to display last 12 months Data in sap HANA?

Apr 24, 2017 at 02:30 PM

44

avatar image
Former Member

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.

declare

v_yearsum number;

begin

for emprecord in (select *from mydata)

loop

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;

end;

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers