sap - How to use the result of SQL aggregate in IF statement -
i trying script procedure in hana, , have requirement compare week id's of 2 tables. if week id1 > week id2
, have insert new records table has id2. tried below logic, did not work.
here, logic within if
not executing, though
var1 varchar(2); var2 varchar(2); begin select max(fiscal_wk) var1 "xxx"."outlook_facts"; select max(fiscal_wk) var2 "xxx"."outlook"; if :var2 > :var1 select max(outlookid) test "xxx"."outlook_facts"; end if; end;
i pretty new this, please help.
in code illustration don't assign values :var1 or :var2, both variables remain empty.
try
select max(fiscal_wk) var1 :var1 "xxx"."outlook_facts"; select max(fiscal_wk) var2 :var2 "xxx"."outlook"; if :var2 > :var1 select max(outlookid) test "xxx"."outlook_facts"; end if;
you could, pack in single sql statement. that's take :)
sap hana
No comments:
Post a Comment